evolve: use compat.TROUBLES to show troubles in user interface
compat.TROUBLES is a dict which contains the trouble name for each trouble
according to the hg version user is using.
All of the replacements are related to `hg evolve` command.
--- a/CHANGELOG Thu Dec 28 04:09:02 2017 +0530
+++ b/CHANGELOG Sat Dec 09 08:19:07 2017 +0530
@@ -4,6 +4,9 @@
7.2.0 - in progress
-------------------
+ * use the new instabilities names from mercurial 4.4+
+ (in `hg evolve --list` and other messages)
+
* new algorithm for obshashrange discovery:
The new algorithm is fast, simpler to cache and with better complexity. It
--- a/hgext3rd/evolve/__init__.py Thu Dec 28 04:09:02 2017 +0530
+++ b/hgext3rd/evolve/__init__.py Sat Dec 09 08:19:07 2017 +0530
@@ -324,6 +324,7 @@
utility,
)
+TROUBLES = compat.TROUBLES
__version__ = metadata.__version__
testedwith = metadata.testedwith
minimumhgversion = metadata.minimumhgversion
@@ -1370,15 +1371,19 @@
fm.data(node=ctx.hex(), rev=ctx.rev(), desc=desc, phase=ctx.phasestr())
for unpar in unpars if showunstable else []:
- fm.plain(' orphan: %s (orphan parent)\n' % unpar[:hashlen])
+ fm.plain(' %s: %s (%s parent)\n' % (TROUBLES['ORPHAN'],
+ unpar[:hashlen],
+ TROUBLES['ORPHAN']))
for obspar in obspars if showunstable else []:
- fm.plain(' unstable: %s (obsolete parent)\n' % obspar[:hashlen])
+ fm.plain(' %s: %s (obsolete parent)\n' % (TROUBLES['ORPHAN'],
+ obspar[:hashlen]))
for imprec in imprecs if showbumped else []:
- fm.plain(' bumped: %s (immutable precursor)\n' % imprec[:hashlen])
+ fm.plain(' %s: %s (immutable precursor)\n' %
+ (TROUBLES['PHASEDIVERGENT'], imprec[:hashlen]))
if dsets and showdivergent:
for dset in dsets:
- fm.plain(' divergent: ')
+ fm.plain(' %s: ' % TROUBLES['CONTENTDIVERGENT'])
first = True
for n in dset['divergentnodes']:
t = "%s (%s)" if first else " %s (%s)"
@@ -1392,19 +1397,21 @@
_formatctx(fm, ctx)
troubles = []
for unpar in unpars:
- troubles.append({'troubletype': 'unstable', 'sourcenode': unpar,
- 'sourcetype': 'unstableparent'})
+ troubles.append({'troubletype': TROUBLES['ORPHAN'],
+ 'sourcenode': unpar, 'sourcetype': 'orphanparent'})
for obspar in obspars:
- troubles.append({'troubletype': 'unstable', 'sourcenode': obspar,
+ troubles.append({'troubletype': TROUBLES['ORPHAN'],
+ 'sourcenode': obspar,
'sourcetype': 'obsoleteparent'})
for imprec in imprecs:
- troubles.append({'troubletype': 'bumped', 'sourcenode': imprec,
+ troubles.append({'troubletype': TROUBLES['PHASEDIVERGENT'],
+ 'sourcenode': imprec,
'sourcetype': 'immutableprecursor'})
for dset in dsets:
divnodes = [{'node': node.hex(n),
'phase': repo[n].phasestr(),
} for n in dset['divergentnodes']]
- troubles.append({'troubletype': 'divergent',
+ troubles.append({'troubletype': TROUBLES['CONTENTDIVERGENT'],
'commonprecursor': node.hex(dset['commonprecursor']),
'divergentnodes': divnodes})
fm.data(troubles=troubles)
@@ -1795,7 +1802,8 @@
repo.ui.write(todo)
repo.ui.write(('hg update %s;\n' % prec))
repo.ui.write(('hg revert --all --rev %s;\n' % bumped))
- repo.ui.write(('hg commit --msg "bumped update to %s"'))
+ repo.ui.write(('hg commit --msg "%s update to %s"\n' %
+ (TROUBLES['PHASEDIVERGENT'], bumped)))
return 0
if progresscb:
progresscb()
@@ -1877,7 +1885,7 @@
base, others = divergentdata(divergent)
if len(others) > 1:
othersstr = "[%s]" % (','.join([str(i) for i in others]))
- msg = _("skipping %d:divergent with a changeset that got split"
+ msg = _("skipping %d:%s with a changeset that got split"
" into multiple ones:\n"
"|[%s]\n"
"| This is not handled by automatic evolution yet\n"
@@ -1887,13 +1895,13 @@
"| - hg prune\n"
"| \n"
"| You should contact your local evolution Guru for help.\n"
- ) % (divergent, othersstr)
+ ) % (divergent, TROUBLES['CONTENTDIVERGENT'], othersstr)
ui.write_err(msg)
return 2
other = others[0]
if len(other.parents()) > 1:
- msg = _("skipping %s: divergent changeset can't be "
- "a merge (yet)\n") % divergent
+ msg = _("skipping %s: %s changeset can't be "
+ "a merge (yet)\n") % (divergent, TROUBLES['CONTENTDIVERGENT'])
ui.write_err(msg)
hint = _("You have to fallback to solving this by hand...\n"
"| This probably means redoing the merge and using \n"
@@ -1938,7 +1946,7 @@
if divergent not in repo[None].parents():
repo.ui.status(_('updating to "local" conflict\n'))
hg.update(repo, divergent.rev())
- repo.ui.note(_('merging divergent changeset\n'))
+ repo.ui.note(_('merging %s changeset\n') % TROUBLES['CONTENTDIVERGENT'])
if progresscb:
progresscb()
stats = merge.update(repo,
--- a/tests/test-evolve-list.t Thu Dec 28 04:09:02 2017 +0530
+++ b/tests/test-evolve-list.t Sat Dec 09 08:19:07 2017 +0530
@@ -20,7 +20,7 @@
2 new orphan changesets
$ hg evolve --list
d2ae7f538514: b
- unstable: cb9a9f314b8b (obsolete parent)
+ orphan: cb9a9f314b8b (obsolete parent)
177f92b77385: c
orphan: d2ae7f538514 (orphan parent)
@@ -37,7 +37,7 @@
1 new phase-divergent changesets
$ hg evolve --list
88cc282e27fc: ab
- bumped: cb9a9f314b8b (immutable precursor)
+ phase-divergent: cb9a9f314b8b (immutable precursor)
$ cd ..
@@ -67,18 +67,18 @@
2 new content-divergent changesets
$ hg evolve --list
c882616e9d84: b
- divergent: a922b3733e98 (draft) (precursor d2ae7f538514)
+ content-divergent: a922b3733e98 (draft) (precursor d2ae7f538514)
a922b3733e98: b
- divergent: c882616e9d84 (draft) (precursor d2ae7f538514)
+ content-divergent: c882616e9d84 (draft) (precursor d2ae7f538514)
$ hg evolve --list --rev c882616e9d84
c882616e9d84: b
- divergent: a922b3733e98 (draft) (precursor d2ae7f538514)
+ content-divergent: a922b3733e98 (draft) (precursor d2ae7f538514)
$ hg phase -p a922b3733e98
$ hg evolve --list
c882616e9d84: b
- divergent: a922b3733e98 (public) (precursor d2ae7f538514)
+ content-divergent: a922b3733e98 (public) (precursor d2ae7f538514)
$ cd ..
--- a/tests/test-stabilize-result.t Thu Dec 28 04:09:02 2017 +0530
+++ b/tests/test-stabilize-result.t Sat Dec 09 08:19:07 2017 +0530
@@ -159,7 +159,7 @@
hg rebase --rev d5c7ef82d003 --dest 66719795a494;
hg update 1cf0aacfd363;
hg revert --all --rev d5c7ef82d003;
- hg commit --msg "bumped update to %s" (no-eol)
+ hg commit --msg "phase-divergent update to d5c7ef82d003"
$ hg evolve --any --confirm --phase-divergent
recreate:[9] newer a
atop:[6] newer a
@@ -267,7 +267,7 @@
merge:[14] More addition
with: [13] More addition
base: [12] More addition
- merging divergent changeset
+ merging content-divergent changeset
resolving manifests
merging a
0 files updated, 1 files merged, 0 files removed, 0 files unresolved