[PATCH] Updated convert-repo script
Bryan O'Sullivan
bos at serpentine.com
Mon May 1 12:31:00 CDT 2006
On Mon, 2006-05-01 at 11:57 -0400, Sébastien Pierre wrote:
> This is my first patch, so I don't know if I'm doing things right here.
Hi, Sebastien -
Thanks for the patch. I have a few comments.
> I also added a more verbose output, to help
> track problems.
Producing verbose output unconditionally is not something that Mercurial
generally does, so each of the print statements that you added should
really have an "if ..." before them.
> +If you specify a MAPFILE, you must first import the first git version
> into
Your patch got line-wrapped, so it wouldn't be possible to apply it.
> + if not os.path.isdir(dest + "/.hg"):
> + command("cd %s ; hg init ; hg commit -A -X .git -m 'Initial
> commit (from git)'; cd .." % (dest))
> + hg_commit = command("cd %s ; hg log -v | grep changeset | tail
> -n1 | cut -d ':' -f3 " % (dest))
> + hg_commit = hg_commit.replace(" ", "").replace("\n", "")
It's quite hard to tell what this code is trying to do, but in general,
running Mercurial commands by shelling out from a Python program doesn't
make much sense. You're much better off calling into the Mercurial API
directly. This is a bit more work, since the API is rather
underdocumented, but it's actually very easy to do, and both more
reliable and faster than a series of shelled programs.
<b
More information about the Mercurial
mailing list