Submitter | Katsunori FUJIWARA |
---|---|
Date | Sept. 30, 2013, 4:49 p.m. |
Message ID | <6426f77e943acab330ce.1380559743@feefifofum> |
Download | mbox | patch |
Permalink | /patch/2680/ |
State | Accepted |
Commit | e7fa36d2ad3a7944a52dca126458d6f482db3524 |
Delegated to: | Augie Fackler |
Headers | show |
Comments
On Tue, Oct 01, 2013 at 01:49:03AM +0900, FUJIWARA Katsunori wrote: > # HG changeset patch > # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp> > # Date 1380555307 -32400 > # Tue Oct 01 00:35:07 2013 +0900 > # Branch stable > # Node ID 6426f77e943acab330ce65d75333cfc74026f814 > # Parent d347f0221d8a513bdfddb25519554de50e2260dc > rebase: catch RepoLookupError at restoring rebase state for summary Series looks good to me, although all three log messages want a (bc) suffix. I'd like someone else to review this, given that it seems right on the hairy edge of Right to me. > > Before this patch, "hg summary" may fail, when there is inconsistent > rebase state: for example, the root of rebase destination revisions > recorded in rebase state file is already stripped manually. > > Mercurial earlier than 2.7 allows users to do anything other than > starting new rebase, even though current rebase is not finished or > aborted yet. So, such inconsistent rebase states may be left and > forgotten in repositories. > > This patch catches RepoLookupError at restoring rebase state for > summary hook, and treat such state as "broken". > > diff --git a/hgext/rebase.py b/hgext/rebase.py > --- a/hgext/rebase.py > +++ b/hgext/rebase.py > @@ -813,7 +813,13 @@ > def summaryhook(ui, repo): > if not os.path.exists(repo.join('rebasestate')): > return > - state = restorestatus(repo)[2] > + try: > + state = restorestatus(repo)[2] > + except error.RepoLookupError: > + # i18n: column positioning for "hg summary" > + msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n') > + ui.write(msg) > + return > numrebased = len([i for i in state.itervalues() if i != -1]) > # i18n: column positioning for "hg summary" > ui.write(_('rebase: %s, %s (rebase --continue)\n') % > diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t > --- a/tests/test-rebase-abort.t > +++ b/tests/test-rebase-abort.t > @@ -95,6 +95,8 @@ > abort: cannot continue inconsistent rebase > (use "hg rebase --abort" to clear borken state) > [255] > + $ hg summary | grep '^rebase: ' > + rebase: (use "hg rebase --abort" to clear broken state) > $ hg rebase --abort > rebase aborted (no revision is removed, only broken state is cleared) > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On Tue, 2013-10-01 at 01:49 +0900, FUJIWARA Katsunori wrote: > # HG changeset patch > # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp> > # Date 1380555307 -32400 > # Tue Oct 01 00:35:07 2013 +0900 > # Branch stable > # Node ID 6426f77e943acab330ce65d75333cfc74026f814 > # Parent d347f0221d8a513bdfddb25519554de50e2260dc > rebase: catch RepoLookupError at restoring rebase state for summary These are queued for stable, thanks. Contrary to Augie, I don't think these need (bc). We broke the (bc) earlier for 2.7, this is just tidying up some of that breakage.
Patch
diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -813,7 +813,13 @@ def summaryhook(ui, repo): if not os.path.exists(repo.join('rebasestate')): return - state = restorestatus(repo)[2] + try: + state = restorestatus(repo)[2] + except error.RepoLookupError: + # i18n: column positioning for "hg summary" + msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n') + ui.write(msg) + return numrebased = len([i for i in state.itervalues() if i != -1]) # i18n: column positioning for "hg summary" ui.write(_('rebase: %s, %s (rebase --continue)\n') % diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t --- a/tests/test-rebase-abort.t +++ b/tests/test-rebase-abort.t @@ -95,6 +95,8 @@ abort: cannot continue inconsistent rebase (use "hg rebase --abort" to clear borken state) [255] + $ hg summary | grep '^rebase: ' + rebase: (use "hg rebase --abort" to clear broken state) $ hg rebase --abort rebase aborted (no revision is removed, only broken state is cleared)