changeset 1470:c3f6e97c71b1

merge with stable
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 30 Jun 2015 18:32:12 -0700
parents 5dfb18b98a55 (current diff) fa1a27009c76 (diff)
children 4140d680784e
files tests/test-tutorial.t
diffstat 6 files changed, 110 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Fri Jun 26 00:07:13 2015 -0700
+++ b/hgext/evolve.py	Tue Jun 30 18:32:12 2015 -0700
@@ -1178,10 +1178,10 @@
         # cluster handling
         nodes = set(mark[1])
         nodes.add(mark[0])
-        _updateclustermap(nodes, mark, clustersmap) 
+        _updateclustermap(nodes, mark, clustersmap)
         # same with parent data
         nodes.update(parents)
-        _updateclustermap(nodes, mark, pclustersmap) 
+        _updateclustermap(nodes, mark, pclustersmap)
 
     # freezing the result
     for c in clustersmap.values():
@@ -1415,6 +1415,24 @@
                 rdependencies[succ].add(r)
     return dependencies, rdependencies
 
+def _dedupedivergents(repo, revs):
+    """Dedupe the divergents revs in revs to get one from each group with the
+    lowest revision numbers
+    """
+    repo = repo.unfiltered()
+    res = set()
+    # To not reevaluate divergents of the same group once one is encountered
+    discarded = set()
+    for rev in revs:
+        if rev in discarded:
+            continue
+        divergent = repo[rev]
+        base, others = divergentdata(divergent)
+        othersrevs = [o.rev() for o in others]
+        res.add(min([divergent.rev()] + othersrevs))
+        discarded.update(othersrevs)
+    return res
+
 def _selectrevs(repo, allopt, revopt, anyopt, targetcat):
     """select troubles in repo matching according to given options"""
     revs = set()
@@ -1424,6 +1442,9 @@
             revs = scmutil.revrange(repo, revopt) & revs
         elif not anyopt and targetcat == 'unstable':
             revs = set(_aspiringdescendant(repo, repo.revs('(.::) - obsolete()::')))
+        if targetcat == 'divergent':
+            # Pick one divergent per group of divergents
+            revs = _dedupedivergents(repo, revs)
     elif anyopt:
         revs = repo.revs('first(%s())' % (targetcat))
     elif targetcat == 'unstable':
@@ -1849,12 +1870,6 @@
         ui.write_err(msg)
         return 2
     other = others[0]
-    if divergent.phase() <= phases.public:
-        msg = _("skipping %s: we can't resolve divergence from the public side\n") % divergent
-        ui.write_err(msg)
-        hint = _("(%s is public, try from %s)\n" % (divergent, other))
-        ui.write_err(hint)
-        return 2
     if len(other.parents()) > 1:
         msg = _("skipping %s: divergent changeset can't be a merge (yet)\n" % divergent)
         ui.write_err(msg)
@@ -2253,7 +2268,7 @@
 
         # create markers
         obsolete.createmarkers(repo, relations, metadata=metadata)
-        
+
         # informs that changeset have been pruned
         ui.status(_('%i changesets pruned\n') % len(precs))
 
@@ -2609,9 +2624,8 @@
 def fold(ui, repo, *revs, **opts):
     """fold multiple revisions into a single one
 
-    Folds a set of revisions with the parent of the working directory.
-    All revisions linearly between the given revisions and the parent
-    of the working directory will also be folded.
+    By default, folds all the revisions linearly between the given revisions
+    and the parent of the working directory.
 
     Use --exact for folding only the specified revisions while ignoring the
     parent of the working directory. In this case, the given revisions must
@@ -2632,9 +2646,13 @@
        See :hg:`help phases` for more about draft revisions and
        :hg:`help revsets` for more about the `draft()` keyword
 
-     - Fold revisions 3, 4, 5, and 6 with the working directory parent::
-
-         hg fold 3:6
+     - Fold revisions between 3 and 6 with the working directory parent::
+
+         hg fold 3::6
+
+     - Fold revisions 3 and 4:
+
+        hg fold "3 + 4" --exact
 
      - Only fold revisions linearly between foo and @::
 
@@ -3333,7 +3351,7 @@
     if new_format == repo.obsstore._version:
         msg = _('New format is the same as the old format, not upgrading!')
         raise util.Abort(msg)
-    f = repo.sopener('obsstore', 'wb', atomictemp=True)
+    f = repo.svfs('obsstore', 'wb', atomictemp=True)
     origmarkers = repo.obsstore._all
     known = set()
     markers = []
--- a/hgext/inhibit.py	Fri Jun 26 00:07:13 2015 -0700
+++ b/hgext/inhibit.py	Tue Jun 30 18:32:12 2015 -0700
@@ -36,7 +36,7 @@
         def _obsinhibit(self):
             # XXX we should make sure it is invalidated by transaction failure
             obsinhibit = set()
-            raw = self.sopener.tryread('obsinhibit')
+            raw = self.svfs.tryread('obsinhibit')
             for i in xrange(0, len(raw), 20):
                 obsinhibit.add(raw[i:i+20])
             return obsinhibit
--- a/hgext/obsolete.py	Fri Jun 26 00:07:13 2015 -0700
+++ b/hgext/obsolete.py	Tue Jun 30 18:32:12 2015 -0700
@@ -48,7 +48,7 @@
     else:
         data = repo.opener.tryread('obsolete-relations')
         if not data:
-            data = repo.sopener.tryread('obsoletemarkers')
+            data = repo.svfs.tryread('obsoletemarkers')
         if data:
             raise util.Abort('old format of obsolete marker detected!\n'
                              'run `hg debugconvertobsolete` once.')
@@ -110,7 +110,7 @@
             except IOError:
                 pass
             ### second (json) format
-            data = repo.sopener.tryread('obsoletemarkers')
+            data = repo.svfs.tryread('obsoletemarkers')
             if data:
                 some = True
                 for oldmark in json.loads(data):
--- a/hgext/pushexperiment.py	Fri Jun 26 00:07:13 2015 -0700
+++ b/hgext/pushexperiment.py	Tue Jun 30 18:32:12 2015 -0700
@@ -80,7 +80,7 @@
         and remote.capable('_push_experiment_pushobsmarkers_0')):
         # push marker early to limit damage of pushing too early.
         try:
-            obsfp = repo.sopener('obsstore')
+            obsfp = repo.svfs('obsstore')
         except IOError as e:
             if e.errno != errno.ENOENT:
                 raise
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-divergent.t	Tue Jun 30 18:32:12 2015 -0700
@@ -0,0 +1,70 @@
+Tests the resolution of divergence
+
+  $ cat >> $HGRCPATH <<EOF
+  > [defaults]
+  > amend=-d "0 0"
+  > fold=-d "0 0"
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > [phases]
+  > publish = False
+  > [diff]
+  > git = 1
+  > unified = 0
+  > [ui]
+  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
+  > [extensions]
+  > hgext.graphlog=
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+  $ mkcommits() {
+  >   for i in $@; do mkcommit $i ; done
+  > }
+
+Basic test of divergence: two divergent changesets with the same parents
+With --all --any we dedupe the divergent and solve the divergence once
+
+  $ hg init test1
+  $ cd test1
+  $ mkcommits _a _b
+  $ hg up "desc(_a)"
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mkcommit bdivergent1
+  created new head
+  $ hg up "desc(_a)"
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mkcommit bdivergent2
+  created new head
+  $ hg prune -s "desc(bdivergent1)" "desc(_b)"
+  1 changesets pruned
+  $ hg prune -s "desc(bdivergent2)" "desc(_b)" --hidden
+  1 changesets pruned
+  2 new divergent changesets
+  $ hg log -G
+  @  3:e708fd28d5cf@default(draft) add bdivergent2 [divergent]
+  |
+  | o  2:c2f698071cba@default(draft) add bdivergent1 [divergent]
+  |/
+  o  0:135f39f4bd78@default(draft) add _a []
+  
+  $ hg evolve --all --any --divergent
+  merge:[2] add bdivergent1
+  with: [3] add bdivergent2
+  base: [1] add _b
+  updating to "local" conflict
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at c26f1d3baed2
+  $ hg log -G
+  @  5:c26f1d3baed2@default(draft) add bdivergent1 []
+  |
+  o  0:135f39f4bd78@default(draft) add _a []
+  
+  $ cd ..  
--- a/tests/test-tutorial.t	Fri Jun 26 00:07:13 2015 -0700
+++ b/tests/test-tutorial.t	Tue Jun 30 18:32:12 2015 -0700
@@ -480,9 +480,8 @@
   
   fold multiple revisions into a single one
   
-      Folds a set of revisions with the parent of the working directory. All
-      revisions linearly between the given revisions and the parent of the
-      working directory will also be folded.
+      By default, folds all the revisions linearly between the given revisions
+      and the parent of the working directory.
   
       Use --exact for folding only the specified revisions while ignoring the
       parent of the working directory. In this case, the given revisions must