[PATCH] rebase: abort if *any* commit in rebase set is public

Martin von Zweigbergk martinvonz at google.com
Sat Mar 11 15:03:00 EST 2017


On Sat, Mar 11, 2017 at 11:56 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> On Sat, 11 Mar 2017 10:47:25 -0800, Martin von Zweigbergk via Mercurial-devel wrote:
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz at google.com>
>> # Date 1489257344 28800
>> #      Sat Mar 11 10:35:44 2017 -0800
>> # Node ID de5616a5d81c49449fdebc80af76b15ed5adc795
>> # Parent  c134a33b1d73896a616475127797ad7fcfa0608d
>> rebase: abort if *any* commit in rebase set is public
>
> Good catch. Queued, thanks.
>
>> --- a/hgext/rebase.py Wed Mar 01 16:19:41 2017 -0800
>> +++ b/hgext/rebase.py Sat Mar 11 10:35:44 2017 -0800
>> @@ -326,11 +326,11 @@
>>              self.ui.status(_('nothing to rebase\n'))
>>              return _nothingtorebase()
>>
>> -        root = min(rebaseset)
>> -        if not self.keepf and not self.repo[root].mutable():
>> -            raise error.Abort(_("can't rebase public changeset %s")
>> -                             % self.repo[root],
>> -                             hint=_("see 'hg help phases' for details"))
>> +        for root in self.repo.set('roots(%ld)', rebaseset):
>> +            if not self.keepf and not self.repo[root].mutable():
>> +                raise error.Abort(_("can't rebase public changeset %s")
>> +                                 % self.repo[root],
>> +                                 hint=_("see 'hg help phases' for details"))
>
> repo.set() yields context objects, so repo[root] isn't necessary. Fixed in
> flight.

Oops, I think I meant to use repo.revs(), but set() is actually better
with your fix on top. Thanks!


More information about the Mercurial-devel mailing list