Submitter | Jeremy Fitzhardinge |
---|---|
Date | May 18, 2017, 8:18 p.m. |
Message ID | <9cb61a4635f1a4a01e12.1495138722@devbig609.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/20688/ |
State | Accepted |
Headers | show |
Comments
On Thu, May 18, 2017 at 1:18 PM, Jeremy Fitzhardinge <jsgf@fb.com> wrote: > # HG changeset patch > # User Jeremy Fitzhardinge <jsgf@fb.com> > # Date 1495138685 25200 > # Thu May 18 13:18:05 2017 -0700 > # Node ID 9cb61a4635f1a4a01e12ff9b6fecd6db81c8a7f3 > # Parent 371f47ab1373be66072dfde447c93a81a6e5068f > rebase: make sure merge state is cleaned up for no-op rebases (issue5494) > > If a rebase ends up doing a no-op commit, make sure the merge state is still cleaned up. > > diff --git a/hgext/rebase.py b/hgext/rebase.py > --- a/hgext/rebase.py > +++ b/hgext/rebase.py > @@ -420,6 +420,11 @@ > editor=editor, > keepbranches=self.keepbranchesf, > date=self.date) > + if newnode is None: > + # If it ended up being a no-op commit, then the normal > + # merge state clean-up path doesn't happen, so do it here. test-check-code.t says this line is too long. I'll fix it in flight, but make sure you run it next time. I don't remember if you need > + # Fix issue5494 > + mergemod.mergestate.clean(repo) > else: > # Skip commit if we are collapsing > repo.dirstate.beginparentchange() > diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t > --- a/tests/test-rebase-interruptions.t > +++ b/tests/test-rebase-interruptions.t Thanks for moving it here. Looks you missed my other two comments. I'll address them in flight. > @@ -272,3 +272,38 @@ > o 0:public 'A' > > $ cd .. > + > +Make sure merge state is cleaned up after a no-op rebase merge (issue5494) > + $ cat >> $HGRCPATH <<EOF > + > [extensions] > + > rebase= > + > EOF > + $ hg init repo > + $ cd repo > + $ echo a >> a > + $ hg commit -qAm base > + $ echo b >> a > + $ hg commit -qm b > + $ hg up .^ test-check-code.t also wanted '.^' wrapped in quotes. Fixed in flight. > + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > + $ echo c >> a > + $ hg commit -qm c > + $ hg rebase -s 1 -d 2 --noninteractive > + rebasing 1:fdaca8533b86 "b" > + merging a > + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') > + unresolved conflicts (see hg resolve, then hg rebase --continue) > + [1] > + $ echo a > a > + $ echo c >> a > + $ hg resolve --mark a > + (no more unresolved files) > + continue: hg rebase --continue > + $ hg rebase --continue > + rebasing 1:fdaca8533b86 "b" > + note: rebase of 1:fdaca8533b86 created no changes to commit > + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-backup.hg (glob) > + $ hg resolve --list > + $ test -e .hg/merge And here it wanted -f instead. Also fixed in flight. > + [1] > + > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
On Thu, May 18, 2017 at 2:18 PM, Martin von Zweigbergk <martinvonz@google.com> wrote: > On Thu, May 18, 2017 at 1:18 PM, Jeremy Fitzhardinge <jsgf@fb.com> wrote: >> # HG changeset patch >> # User Jeremy Fitzhardinge <jsgf@fb.com> >> # Date 1495138685 25200 >> # Thu May 18 13:18:05 2017 -0700 >> # Node ID 9cb61a4635f1a4a01e12ff9b6fecd6db81c8a7f3 >> # Parent 371f47ab1373be66072dfde447c93a81a6e5068f >> rebase: make sure merge state is cleaned up for no-op rebases (issue5494) >> >> If a rebase ends up doing a no-op commit, make sure the merge state is still cleaned up. >> >> diff --git a/hgext/rebase.py b/hgext/rebase.py >> --- a/hgext/rebase.py >> +++ b/hgext/rebase.py >> @@ -420,6 +420,11 @@ >> editor=editor, >> keepbranches=self.keepbranchesf, >> date=self.date) >> + if newnode is None: >> + # If it ended up being a no-op commit, then the normal >> + # merge state clean-up path doesn't happen, so do it here. > > test-check-code.t says this line is too long. I'll fix it in flight, > but make sure you run it next time. I don't remember if you need Oops, unfinished sentence. What I meant to say is that I don't remember if you need to install anything for it to run. > >> + # Fix issue5494 >> + mergemod.mergestate.clean(repo) >> else: >> # Skip commit if we are collapsing >> repo.dirstate.beginparentchange() >> diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t >> --- a/tests/test-rebase-interruptions.t >> +++ b/tests/test-rebase-interruptions.t > > Thanks for moving it here. Looks you missed my other two comments. > I'll address them in flight. > >> @@ -272,3 +272,38 @@ >> o 0:public 'A' >> >> $ cd .. >> + >> +Make sure merge state is cleaned up after a no-op rebase merge (issue5494) >> + $ cat >> $HGRCPATH <<EOF >> + > [extensions] >> + > rebase= >> + > EOF >> + $ hg init repo >> + $ cd repo >> + $ echo a >> a >> + $ hg commit -qAm base >> + $ echo b >> a >> + $ hg commit -qm b >> + $ hg up .^ > > test-check-code.t also wanted '.^' wrapped in quotes. Fixed in flight. > >> + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved >> + $ echo c >> a >> + $ hg commit -qm c >> + $ hg rebase -s 1 -d 2 --noninteractive >> + rebasing 1:fdaca8533b86 "b" >> + merging a >> + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') >> + unresolved conflicts (see hg resolve, then hg rebase --continue) >> + [1] >> + $ echo a > a >> + $ echo c >> a >> + $ hg resolve --mark a >> + (no more unresolved files) >> + continue: hg rebase --continue >> + $ hg rebase --continue >> + rebasing 1:fdaca8533b86 "b" >> + note: rebase of 1:fdaca8533b86 created no changes to commit >> + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-backup.hg (glob) >> + $ hg resolve --list >> + $ test -e .hg/merge > > And here it wanted -f instead. Also fixed in flight. > >> + [1] >> + >> _______________________________________________ >> Mercurial-devel mailing list >> Mercurial-devel@mercurial-scm.org >> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -420,6 +420,11 @@ editor=editor, keepbranches=self.keepbranchesf, date=self.date) + if newnode is None: + # If it ended up being a no-op commit, then the normal + # merge state clean-up path doesn't happen, so do it here. + # Fix issue5494 + mergemod.mergestate.clean(repo) else: # Skip commit if we are collapsing repo.dirstate.beginparentchange() diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t --- a/tests/test-rebase-interruptions.t +++ b/tests/test-rebase-interruptions.t @@ -272,3 +272,38 @@ o 0:public 'A' $ cd .. + +Make sure merge state is cleaned up after a no-op rebase merge (issue5494) + $ cat >> $HGRCPATH <<EOF + > [extensions] + > rebase= + > EOF + $ hg init repo + $ cd repo + $ echo a >> a + $ hg commit -qAm base + $ echo b >> a + $ hg commit -qm b + $ hg up .^ + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo c >> a + $ hg commit -qm c + $ hg rebase -s 1 -d 2 --noninteractive + rebasing 1:fdaca8533b86 "b" + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + unresolved conflicts (see hg resolve, then hg rebase --continue) + [1] + $ echo a > a + $ echo c >> a + $ hg resolve --mark a + (no more unresolved files) + continue: hg rebase --continue + $ hg rebase --continue + rebasing 1:fdaca8533b86 "b" + note: rebase of 1:fdaca8533b86 created no changes to commit + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-backup.hg (glob) + $ hg resolve --list + $ test -e .hg/merge + [1] +