changeset 2835:20c2499ce8bc

log: divergent was renamed into contentdivergent Divergent was renamed into contentdivergent, update tests. Match 2194a8723138 mercurial changeset.
author Boris Feld <boris.feld@octobus.net>
date Thu, 10 Aug 2017 17:57:50 +0200
parents 38db1466c6fb
children feaa52680682
files hgext3rd/evolve/__init__.py hgext3rd/evolve/compat.py tests/test-divergent.t tests/test-evolve-obshistory.t tests/test-evolve-templates.t tests/test-obsolete.t tests/test-sharing.t tests/test-stabilize-result.t tests/test-uncommit.t
diffstat 9 files changed, 69 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Thu Aug 10 17:37:31 2017 +0200
+++ b/hgext3rd/evolve/__init__.py	Thu Aug 10 17:57:50 2017 +0200
@@ -670,7 +670,7 @@
     if reason == 'pruned':
         solvemsg = _("use 'hg evolve' to update to its parent successor")
     elif reason == 'diverged':
-        debugcommand = "hg evolve --list --divergent"
+        debugcommand = "hg evolve --list --contentdivergent"
         basemsg = _("%s has diverged, use '%s' to resolve the issue")
         solvemsg = basemsg % (shortnode, debugcommand)
     elif reason == 'superseed':
@@ -997,7 +997,7 @@
             result = _solveunstable(ui, repo, ctx, dryrun, confirm, progresscb)
         elif 'bumped' == category:
             result = _solvebumped(ui, repo, ctx, dryrun, confirm, progresscb)
-        elif 'divergent' == category:
+        elif 'contentdivergent' == category:
             result = _solvedivergent(ui, repo, ctx, dryrun, confirm,
                                      progresscb)
         else:
@@ -1010,35 +1010,35 @@
 def _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat):
     """Used by the evolve function to display an error message when
     no troubles can be resolved"""
-    troublecategories = ['bumped', 'divergent', 'orphan']
+    troublecategories = ['bumped', 'contentdivergent', 'orphan']
     unselectedcategories = [c for c in troublecategories if c != targetcat]
     msg = None
     hint = None
 
     troubled = {
         "orphan": repo.revs("unstable()"),
-        "divergent": repo.revs("divergent()"),
+        "contentdivergent": repo.revs("divergent()"),
         "bumped": repo.revs("bumped()"),
         "all": repo.revs("troubled()"),
     }
 
     hintmap = {
         'bumped': _("do you want to use --bumped"),
-        'bumped+divergent': _("do you want to use --bumped or --divergent"),
+        'bumped+contentdivergent': _("do you want to use --bumped or --contentdivergent"),
         'bumped+orphan': _("do you want to use --bumped or --orphan"),
-        'divergent': _("do you want to use --divergent"),
-        'divergent+orphan': _("do you want to use --divergent"
-                              " or --orphan"),
+        'contentdivergent': _("do you want to use --contentdivergent"),
+        'contentdivergent+orphan': _("do you want to use --contentdivergent"
+                                     " or --orphan"),
         'orphan': _("do you want to use --orphan"),
         'any+bumped': _("do you want to use --any (or --rev) and --bumped"),
-        'any+bumped+divergent': _("do you want to use --any (or --rev) and"
-                                  " --bumped or --divergent"),
+        'any+bumped+contentdivergent': _("do you want to use --any (or --rev) and"
+                                         " --bumped or --contentdivergent"),
         'any+bumped+orphan': _("do you want to use --any (or --rev) and"
                                "--bumped or --orphan"),
-        'any+divergent': _("do you want to use --any (or --rev) and"
-                           " --divergent"),
-        'any+divergent+orphan': _("do you want to use --any (or --rev)"
-                                  " and --divergent or --orphan"),
+        'any+contentdivergent': _("do you want to use --any (or --rev) and"
+                                  " --contentdivergent"),
+        'any+contentdivergent+orphan': _("do you want to use --any (or --rev)"
+                                         " and --contentdivergent or --orphan"),
         'any+orphan': _("do you want to use --any (or --rev)"
                         "and --orphan"),
     }
@@ -1183,6 +1183,10 @@
         discarded.update(othersrevs)
     return res
 
+instabilities_map = {
+    'contentdivergent': "content-divergent"
+}
+
 def _selectrevs(repo, allopt, revopt, anyopt, targetcat):
     """select troubles in repo matching according to given options"""
     revs = set()
@@ -1198,7 +1202,7 @@
                 revs = _aspiringdescendant(repo,
                                            repo.revs('(.::) - obsolete()::'))
                 revs = set(revs)
-        if targetcat == 'divergent':
+        if targetcat == 'contentdivergent':
             # Pick one divergent per group of divergents
             revs = _dedupedivergents(repo, revs)
     elif anyopt:
@@ -1210,7 +1214,7 @@
             hint = (_("select one of %s with --rev")
                     % ', '.join([str(repo[r]) for r in sorted(revs)]))
             raise error.Abort(msg, hint=hint)
-    elif targetcat in repo['.'].instabilities():
+    elif instabilities_map.get(targetcat, targetcat) in repo['.'].instabilities():
         revs = set([repo['.'].rev()])
     return revs
 
@@ -1287,10 +1291,10 @@
 
 def listtroubles(ui, repo, troublecategories, **opts):
     """Print all the troubles for the repo (or given revset)"""
-    troublecategories = troublecategories or ['divergent', 'orphan', 'bumped']
+    troublecategories = troublecategories or ['contentdivergent', 'orphan', 'bumped']
     showunstable = 'orphan' in troublecategories
     showbumped = 'bumped' in troublecategories
-    showdivergent = 'divergent' in troublecategories
+    showdivergent = 'contentdivergent' in troublecategories
 
     revs = repo.revs('+'.join("%s()" % t for t in troublecategories))
     if opts.get('rev'):
@@ -1370,6 +1374,7 @@
      ('r', 'rev', [], _('solves troubles of these revisions')),
      ('', 'bumped', False, _('solves only bumped changesets')),
      ('', 'divergent', False, _('solves only divergent changesets')),
+     ('', 'contentdivergent', False, _('solves only contentdivergent changesets')),
      ('', 'unstable', False, _('solves only unstable changesets')),
      ('', 'orphan', False, _('solves only orphan changesets (default)')),
      ('a', 'all', False, _('evolve all troubled changesets related to the '
@@ -1467,7 +1472,14 @@
 
         opts['orphan'] = opts['divergent']
 
-    troublecategories = ['bumped', 'divergent', 'orphan']
+    if opts['divergent']:
+        msg = ("'evolve --divergent' is deprecated, "
+               "use 'evolve --contentdivergent'")
+        repo.ui.deprecwarn(msg, '4.4')
+
+        opts['contentdivergent'] = opts['divergent']
+
+    troublecategories = ['bumped', 'contentdivergent', 'orphan']
     specifiedcategories = [t for t in troublecategories if opts[t]]
     if listopt:
         listtroubles(ui, repo, specifiedcategories, **opts)
--- a/hgext3rd/evolve/compat.py	Thu Aug 10 17:37:31 2017 +0200
+++ b/hgext3rd/evolve/compat.py	Thu Aug 10 17:57:50 2017 +0200
@@ -98,11 +98,19 @@
 if not util.safehasattr(context.basectx, 'orphan'):
     context.basectx.orphan = context.basectx.unstable
 
+if not util.safehasattr(context.basectx, 'contentdivergent'):
+    context.basectx.contentdivergent = context.basectx.divergent
+
 if not util.safehasattr(revset, 'orphan'):
     @eh.revset('orphan')
     def oprhanrevset(*args, **kwargs):
         return revset.unstable(*args, **kwargs)
 
+if not util.safehasattr(revset, 'contentdivergent'):
+    @eh.revset('contentdivergent')
+    def contentdivergentrevset(*args, **kwargs):
+        return revset.divergent(*args, **kwargs)
+
 if not util.safehasattr(context.basectx, 'instabilities'):
     def instabilities(self):
         """return the list of instabilities affecting this changeset.
@@ -117,8 +125,8 @@
             instabilities.append('unstable')
         if self.bumped():
             instabilities.append('bumped')
-        if self.divergent():
-            instabilities.append('divergent')
+        if self.contentdivergent():
+            instabilities.append('content-divergent')
         return instabilities
 
     context.basectx.instabilities = instabilities
--- a/tests/test-divergent.t	Thu Aug 10 17:37:31 2017 +0200
+++ b/tests/test-divergent.t	Thu Aug 10 17:57:50 2017 +0200
@@ -47,13 +47,13 @@
   1 changesets pruned
   2 new divergent changesets
   $ hg log -G
-  @  3:e708fd28d5cf@default(draft) add bdivergent2 [divergent]
+  @  3:e708fd28d5cf@default(draft) add bdivergent2 [content-divergent]
   |
-  | o  2:c2f698071cba@default(draft) add bdivergent1 [divergent]
+  | o  2:c2f698071cba@default(draft) add bdivergent1 [content-divergent]
   |/
   o  0:135f39f4bd78@default(draft) add _a []
   
-  $ hg evolve --all --any --divergent
+  $ hg evolve --all --any --contentdivergent
   merge:[2] add bdivergent1
   with: [3] add bdivergent2
   base: [1] add _b
@@ -90,15 +90,15 @@
   1 changesets pruned
   2 new divergent changesets
   $ hg log -G
-  @  8:0a768ef678d9@default(draft) cdivergent2 [divergent]
+  @  8:0a768ef678d9@default(draft) cdivergent2 [content-divergent]
   |
-  | o  7:26c7705fee96@default(draft) add cdivergent1 [divergent]
+  | o  7:26c7705fee96@default(draft) add cdivergent1 [content-divergent]
   |/
   | o  5:c26f1d3baed2@default(draft) add bdivergent1 []
   |/
   o  0:135f39f4bd78@default(draft) add _a []
   
-  $ hg evolve --all --any --divergent
+  $ hg evolve --all --any --contentdivergent
   merge:[7] add cdivergent1
   with: [8] cdivergent2
   base: [6] add _c
@@ -126,9 +126,9 @@
   1 changesets pruned
   2 new divergent changesets
   $ hg log -G
-  @  3:e708fd28d5cf@default(draft) add bdivergent2 [divergent]
+  @  3:e708fd28d5cf@default(draft) add bdivergent2 [content-divergent]
   |
-  | o  2:c2f698071cba@default(draft) add bdivergent1 [divergent]
+  | o  2:c2f698071cba@default(draft) add bdivergent1 [content-divergent]
   |/
   o  0:135f39f4bd78@default(draft) add _a []
   
@@ -145,9 +145,9 @@
   > EOF
   $ hg evolve --all
   nothing to evolve on current working copy parent
-  (do you want to use --divergent)
+  (do you want to use --contentdivergent)
   [2]
-  $ hg evolve --divergent
+  $ hg evolve --contentdivergent
   merge:[3] add bdivergent2
   with: [2] add bdivergent1
   base: [1] add _b
--- a/tests/test-evolve-obshistory.t	Thu Aug 10 17:37:31 2017 +0200
+++ b/tests/test-evolve-obshistory.t	Thu Aug 10 17:57:50 2017 +0200
@@ -996,14 +996,14 @@
   |  parent:      0:ea207398892e
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  instability: divergent
+  |  instability: content-divergent
   |  summary:     A2
   |
   | o  changeset:   2:fdf9bde5129a
   |/   parent:      0:ea207398892e
   |    user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    instability: divergent
+  |    instability: content-divergent
   |    summary:     A1
   |
   | x  changeset:   1:471f378eab4c
@@ -1267,7 +1267,7 @@
   $ hg update --hidden 'desc(A0)'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete! (471f378eab4c)
-  (471f378eab4c has diverged, use 'hg evolve --list --divergent' to resolve the issue)
+  (471f378eab4c has diverged, use 'hg evolve --list --contentdivergent' to resolve the issue)
 
 Test output with amended + folded commit
 ========================================
--- a/tests/test-evolve-templates.t	Thu Aug 10 17:37:31 2017 +0200
+++ b/tests/test-evolve-templates.t	Thu Aug 10 17:57:50 2017 +0200
@@ -625,14 +625,14 @@
   |  parent:      0:ea207398892e
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  instability: divergent
+  |  instability: content-divergent
   |  summary:     A2
   |
   | o  changeset:   2:fdf9bde5129a
   |/   parent:      0:ea207398892e
   |    user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    instability: divergent
+  |    instability: content-divergent
   |    summary:     A1
   |
   | x  changeset:   1:471f378eab4c
@@ -655,7 +655,7 @@
   $ hg up 'desc(A0)' --hidden
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete! (471f378eab4c)
-  (471f378eab4c has diverged, use 'hg evolve --list --divergent' to resolve the issue)
+  (471f378eab4c has diverged, use 'hg evolve --list --contentdivergent' to resolve the issue)
 
 Precursors template should show current revision as it is the working copy
   $ hg tlog
--- a/tests/test-obsolete.t	Thu Aug 10 17:37:31 2017 +0200
+++ b/tests/test-obsolete.t	Thu Aug 10 17:57:50 2017 +0200
@@ -686,7 +686,7 @@
   parent:      10:2033b4e49474
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
-  instability: bumped, divergent
+  instability: bumped, content-divergent
   summary:     add obsol_d'''
   
   changeset:   16:50f11e5e3a63
@@ -694,7 +694,7 @@
   parent:      11:9468a5f5d8b2
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
-  instability: divergent
+  instability: content-divergent
   summary:     add obsolet_conflicting_d
   
 
@@ -719,7 +719,7 @@
   $ hg up --hidden 2
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   working directory parent is obsolete! (4538525df7e2)
-  (4538525df7e2 has diverged, use 'hg evolve --list --divergent' to resolve the issue)
+  (4538525df7e2 has diverged, use 'hg evolve --list --contentdivergent' to resolve the issue)
   $ hg export 9468a5f5d8b2 | hg import -
   applying patch from stdin
   1 new unstable changesets
@@ -741,7 +741,7 @@
   | |  parent:      11:9468a5f5d8b2
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
-  | |  instability: divergent
+  | |  instability: content-divergent
   | |  summary:     add obsolet_conflicting_d
   | |
   | | o  changeset:   15:705ab2a6b72e
@@ -767,7 +767,7 @@
   | | |/   parent:      10:2033b4e49474
   | | |    user:        test
   | | |    date:        Thu Jan 01 00:00:00 1970 +0000
-  | | |    instability: bumped, divergent
+  | | |    instability: bumped, content-divergent
   | | |    summary:     add obsol_d'''
   | | |
   | o |  changeset:   11:9468a5f5d8b2
--- a/tests/test-sharing.t	Thu Aug 10 17:37:31 2017 +0200
+++ b/tests/test-sharing.t	Thu Aug 10 17:57:50 2017 +0200
@@ -514,7 +514,7 @@
   7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
 
 Use evolve to fix the divergence.
-  $ HGMERGE=internal:other hg evolve --divergent
+  $ HGMERGE=internal:other hg evolve --contentdivergent
   merge:[6] fix bug 24 (v2 by bob)
   with: [7] fix bug 24 (v2 by alice)
   base: [4] fix bug 24 (v1)
--- a/tests/test-stabilize-result.t	Thu Aug 10 17:37:31 2017 +0200
+++ b/tests/test-stabilize-result.t	Thu Aug 10 17:57:50 2017 +0200
@@ -247,14 +247,14 @@
 
 Stabilize it
 
-  $ hg evolve -qn --confirm --divergent
+  $ hg evolve -qn --confirm --contentdivergent
   merge:[19] More addition
   with: [17] More addition
   base: [15] More addition
   perform evolve? [Ny] n
   abort: evolve aborted by user
   [255]
-  $ echo y | hg evolve -qn --confirm --config ui.interactive=True --divergent
+  $ echo y | hg evolve -qn --confirm --config ui.interactive=True --contentdivergent
   merge:[19] More addition
   with: [17] More addition
   base: [15] More addition
@@ -265,7 +265,7 @@
   hg up -C 3932c176bbaa &&
   hg revert --all --rev tip &&
   hg commit -m "`hg log -r eacc9c8240fe --template={desc}`";
-  $ hg evolve -v --divergent
+  $ hg evolve -v --contentdivergent
   merge:[19] More addition
   with: [17] More addition
   base: [15] More addition
@@ -344,14 +344,14 @@
   $ hg phase 'divergent()'
   21: draft
   24: draft
-  $ hg evolve -qn --divergent
+  $ hg evolve -qn --contentdivergent
   hg update -c 0b336205a5d0 &&
   hg merge f344982e63c4 &&
   hg commit -m "auto merge resolving conflict between 0b336205a5d0 and f344982e63c4"&&
   hg up -C 3932c176bbaa &&
   hg revert --all --rev tip &&
   hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
-  $ hg evolve --divergent
+  $ hg evolve --contentdivergent
   merge:[24] More addition (2)
   with: [21] More addition
   base: [15] More addition
--- a/tests/test-uncommit.t	Thu Aug 10 17:37:31 2017 +0200
+++ b/tests/test-uncommit.t	Thu Aug 10 17:57:50 2017 +0200
@@ -287,7 +287,7 @@
   $ hg up -C 3 --hidden
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete! (5eb72dbe0cb4)
-  (5eb72dbe0cb4 has diverged, use 'hg evolve --list --divergent' to resolve the issue)
+  (5eb72dbe0cb4 has diverged, use 'hg evolve --list --contentdivergent' to resolve the issue)
   $ hg --config extensions.purge= purge
   $ hg uncommit --all -X e
   1 new divergent changesets