[PATCH 4 of 5 evolve-ext] evolve: add selector for trouble types
Laurent Charignon
lcharignon at fb.com
Wed May 13 17:04:22 UTC 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1431532715 25200
# Wed May 13 08:58:35 2015 -0700
# Node ID f7b2e0e5e05e76d181c99e6ed3fbcc9508cc0c33
# Parent 96db44ca62d46ac9b57042885e40adb8c1fd9e4e
evolve: add selector for trouble types
This patch adds command line flags to select the kind of troubles to solve.
It is limited to --rev. The default of --rev remains solving all three kinds of
troubles.
diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1243,6 +1243,9 @@
'ask for confirmation before performing the action'),
('A', 'any', False, 'also consider troubled changesets unrelated to current working directory'),
('r', 'rev', '', 'solves troubles of these revisions'),
+ ('', 'bumped', False, 'with --rev: solves only bumped changesets'),
+ ('', 'divergent', False, 'with --rev: solves only divergent changesets'),
+ ('', 'unstable', False, 'with --rev: solves only unstable changesets'),
('a', 'all', False, 'evolve all troubled changesets in the repo '
'(implies any)'),
('c', 'continue', False, 'continue an interrupted evolution'),
@@ -1281,6 +1284,7 @@
dryrunopt = opts['dry_run']
confirmopt = opts['confirm']
revopt = opts['rev']
+ troubletypes = ['bumped', 'divergent', 'unstable']
ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve')
troubled = set(repo.revs('troubled()'))
@@ -1304,7 +1308,12 @@
# Rev specified on the commands line
if revopt:
revs = repo.revs(revopt)
- troubled = repo.revs('troubled()')
+ # () as we use these in a revset
+ specifictypes = [t + '()' for t in troubletypes if opts[t]]
+ if specifictypes:
+ troubled = repo.revs(' or '.join(specifictypes))
+ else:
+ troubled = repo.revs('troubled()')
_revs = revs & troubled
if not _revs:
ui.write_err("No troubled changes in the specified revset\n")
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -1001,7 +1001,9 @@
|
o 0 : a0 - test
- $ hg evolve --rev "14::"
+ $ hg evolve --rev "14::" --bumped
+ No troubled changes in the specified revset
+ $ hg evolve --rev "14::" --unstable
move:[15] add gg
atop:[18] a3
move:[16] add gh
More information about the Mercurial-devel
mailing list