[PATCH 3 of 3] convert/mtn: Avoid unnecessary initial test of mtn repo

Daniel Atallah daniel.atallah at gmail.com
Wed Mar 23 19:38:57 CDT 2011


On Wed, Mar 23, 2011 at 20:04, Patrick Mézard <pmezard at gmail.com> wrote:
> Le 23/03/11 20:24, daniel.atallah at gmail.com a écrit :
>> # HG changeset patch
>> # User Daniel Atallah <daniel.atallah at gmail.com>
>> # Date 1300907025 14400
>> # Branch stable
>> # Node ID 4aa86a646c758dd86c13b4172d5e52f72c59b66c
>> # Parent  d2ef3495b1a62785683fc2a57212e8f2d2500fc6
>> convert/mtn: Avoid unnecessary initial test of mtn repo
>>
>> As soon as begin() is called, we'll know if there is a problem (and get a better
>> error message).
>
> I do not understand this patch. Is begin() really before()? Where do you expect it to fail? Will it fail in non-stdioautomate mode too?

Yes, oops - it is before() that I meant, I'll fix the comment in the
next version.

As far as I can tell the "getheads()" call that is currently there
will throw an Exception only when an error happens with the mtn call
blows up, not based on the content returned.

What is in before() now that will fail in a corresponding manner is
the mtnrunsingle("interface_version") call - which I believe will fail
under the same type of conditions (except, I suppose, if for some
reason 'automate leaves' return a non-0 value).

Hopefully that explains what I was thinking.

The reason that I ran into this was that I had broken all of the mtn
interaction at some point during working on the other patches and it I
was confused because the log was saying that my repository wasn't a
valid mtn repository.

>
>> diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
>> --- a/hgext/convert/monotone.py
>> +++ b/hgext/convert/monotone.py
>> @@ -20,6 +20,7 @@
>>          self.ui = ui
>>          self.path = path
>>          self.automatestdio = False
>> +        self.rev = rev
>>
>>          norepo = NoRepo(_("%s does not look like a monotone repository")
>>                          % path)
>> @@ -65,14 +66,6 @@
>>
>>          checktool('mtn', abort=False)
>>
>> -        # test if there are any revisions
>> -        self.rev = None
>> -        try:
>> -            self.getheads()
>> -        except:
>> -            raise norepo
>> -        self.rev = rev
>> -
>>      def mtnrun(self, *args, **kwargs):
>>          if self.automatestdio:
>>              return self.mtnrunstdio(*args, **kwargs)
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>>
>
>


More information about the Mercurial-devel mailing list