Mercurial > hg
comparison hgext/rebase.py @ 19849:e7fa36d2ad3a stable 2.7.2
rebase: catch RepoLookupError at restoring rebase state for summary
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".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 01 Oct 2013 00:35:07 +0900 |
parents | 577f4c562d52 |
children | 57479e0d203d |
comparison
equal
deleted
inserted
replaced
19848:577f4c562d52 | 19849:e7fa36d2ad3a |
---|---|
811 orig(ui, repo, *args, **opts) | 811 orig(ui, repo, *args, **opts) |
812 | 812 |
813 def summaryhook(ui, repo): | 813 def summaryhook(ui, repo): |
814 if not os.path.exists(repo.join('rebasestate')): | 814 if not os.path.exists(repo.join('rebasestate')): |
815 return | 815 return |
816 state = restorestatus(repo)[2] | 816 try: |
817 state = restorestatus(repo)[2] | |
818 except error.RepoLookupError: | |
819 # i18n: column positioning for "hg summary" | |
820 msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n') | |
821 ui.write(msg) | |
822 return | |
817 numrebased = len([i for i in state.itervalues() if i != -1]) | 823 numrebased = len([i for i in state.itervalues() if i != -1]) |
818 # i18n: column positioning for "hg summary" | 824 # i18n: column positioning for "hg summary" |
819 ui.write(_('rebase: %s, %s (rebase --continue)\n') % | 825 ui.write(_('rebase: %s, %s (rebase --continue)\n') % |
820 (ui.label(_('%d rebased'), 'rebase.rebased') % numrebased, | 826 (ui.label(_('%d rebased'), 'rebase.rebased') % numrebased, |
821 ui.label(_('%d remaining'), 'rebase.remaining') % | 827 ui.label(_('%d remaining'), 'rebase.remaining') % |