patch: monotone source for mercurial convert extension

Maxim Dounin mdounin at
Sat Feb 2 18:24:14 CST 2008


On Sat, Feb 02, 2008 at 07:39:58PM +0100, Mikkel Fahn??e J??rgensen wrote:

>Here is an export from monotone to mercurial.
>It is based on the mecurial convert extension in hgext/convert.

Some comments below. And thank you for contribution.

>It's my first Python program, so ...

Looks like standard disclaimer here. :)

>+        norepo = NoRepo("%s does not look like a monotone repo" % path)
>+        if not os.path.exists(path):
>+            raise norepo

It's probably a good idea to use _() here to allow localization of 
error messages. 

>+    def mtncmd(self, arg):
>+        cmdline = "mtn -d %s automate %s" % (util.shellquote(self.path), arg)
>+        self.ui.debug(cmdline, '\n')
>+        p = util.popen(cmdline)
>+        result =
>+        if p.close():
>+            raise IOError()
>+        return result

Please consider using commandline class for this instead. It looks 
for me that commandline.run0() does exactly what you want. 
Examples are in darcs_source and svn_sink code.

Maxim Dounin

More information about the Mercurial-devel mailing list