branching: merge with stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 31 Jul 2018 09:03:35 +0200
changeset 3902 9c4847b93d3c
parent 3897 83e8803e1cf1 (current diff)
parent 3901 f2b8429db565 (diff)
child 3903 038cdaca7145
branching: merge with stable
hgext3rd/topic/__init__.py
--- a/hgext3rd/evolve/utility.py	Fri May 25 17:17:56 2018 +0200
+++ b/hgext3rd/evolve/utility.py	Tue Jul 31 09:03:35 2018 +0200
@@ -104,9 +104,12 @@
                 succ = _singlesuccessor(repo, p)
             except MultipleSuccessorsError as exc:
                 tset = set()
-                for node in exc.successorssets[0]:
-                    tset.add(repo[node].rev())
-                dependencies[r] = tset
+                for successorsset in exc.successorssets:
+                    for node in successorsset:
+                        succ = repo[node].rev()
+                        if succ in revs:
+                            tset.add(succ)
+                dependencies[r].update(tset)
                 continue
             if succ in revs:
                 dependencies[r].add(succ)
--- a/hgext3rd/topic/__init__.py	Fri May 25 17:17:56 2018 +0200
+++ b/hgext3rd/topic/__init__.py	Tue Jul 31 09:03:35 2018 +0200
@@ -364,7 +364,7 @@
         def commit(self, *args, **kwargs):
             backup = self.ui.backupconfig('ui', 'allowemptycommit')
             try:
-                if repo.currenttopic != repo['.'].topic():
+                if self.currenttopic != self['.'].topic():
                     # bypass the core "nothing changed" logic
                     self.ui.setconfig('ui', 'allowemptycommit', True)
                 return super(topicrepo, self).commit(*args, **kwargs)
@@ -374,7 +374,7 @@
         def commitctx(self, ctx, error=None):
             topicfilter = topicmap.topicfilter(self.filtername)
             if topicfilter != self.filtername:
-                other = repo.filtered(topicmap.topicfilter(repo.filtername))
+                other = self.filtered(topicmap.topicfilter(self.filtername))
                 other.commitctx(ctx, error=error)
 
             if isinstance(ctx, context.workingcommitctx):
@@ -409,7 +409,7 @@
 
         def branchmap(self, topic=None):
             if topic is None:
-                topic = getattr(repo, '_autobranchmaptopic', False)
+                topic = getattr(self, '_autobranchmaptopic', False)
             topicfilter = topicmap.topicfilter(self.filtername)
             if not topic or topicfilter == self.filtername:
                 return super(topicrepo, self).branchmap()
@@ -437,7 +437,7 @@
                 return tr
 
             reporef = weakref.ref(self)
-            if repo.ui.configbool('experimental', 'enforce-single-head'):
+            if self.ui.configbool('experimental', 'enforce-single-head'):
                 origvalidator = tr.validator
 
                 def validator(tr2):
@@ -446,7 +446,7 @@
                     origvalidator(tr2)
                 tr.validator = validator
 
-            topicmodeserver = repo.ui.config('experimental',
+            topicmodeserver = self.ui.config('experimental',
                                              'topic-mode.server', 'ignore')
             ispush = (desc.startswith('push') or desc.startswith('serve'))
             if (topicmodeserver != 'ignore' and ispush):
@@ -458,7 +458,7 @@
                     return origvalidator(tr2)
                 tr.validator = validator
 
-            elif (repo.ui.configbool('experimental', 'topic.publish-bare-branch')
+            elif (self.ui.configbool('experimental', 'topic.publish-bare-branch')
                     and (desc.startswith('push')
                          or desc.startswith('serve'))
                     ):
--- a/tests/test-evolve-issue5832.t	Fri May 25 17:17:56 2018 +0200
+++ b/tests/test-evolve-issue5832.t	Tue Jul 31 09:03:35 2018 +0200
@@ -180,7 +180,13 @@
   |/    () draft
   o  0:bde1d2b6b5e5 added base
       () draft
- 
+  $ hg log -r 'p1(.)'
+  changeset:   3:9402371b436e
+  parent:      0:bde1d2b6b5e5
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c and d
+  
   $ hg up bde1d2b6b5e5
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   $ echo l > l
@@ -279,3 +285,149 @@
   |/    () draft
   o  0:bde1d2b6b5e5 added base
       () draft
+
+Test for issue5946 present at https://bz.mercurial-scm.org/show_bug.cgi?id=5946
+===============================================================================
+issue with computing dependency with split and merge
+
+  $ hg init issue5946
+  $ cd issue5946
+  $ echo base > base
+  $ hg ci -Aqm "added base"
+
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo c > c
+  $ echo d > d
+  $ hg ci -Aqm "added c and d"
+The next line is the only difference from issue5833 above, i.e. the order of
+the parents is reversed
+  $ hg co 2
+  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+
+  $ hg merge
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m "merge commit"
+
+  $ hg glog
+  @    4:b9b387427a53 merge commit
+  |\    () draft
+  | o  3:9402371b436e added c and d
+  | |   () draft
+  o |  2:a1da0651488c added b
+  | |   () draft
+  o |  1:1b24879c5c3c added a
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft
+  $ hg log -r 'p1(.)'
+  changeset:   2:a1da0651488c
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added b
+  
+  $ hg up bde1d2b6b5e5
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ echo l > l
+  $ hg ci -Aqm "added l"
+  $ hg grab -r 1b24879c5c3c
+  grabbing 1:1b24879c5c3c "added a"
+  2 new orphan changesets
+
+  $ hg up bde1d2b6b5e5
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo c > c
+  $ hg ci -Aqm "added c"
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg ci -Aqm "added d"
+
+  $ hg glog
+  @  8:5841d7cf9893 added d
+  |   () draft
+  | o  7:62fb70414f99 added c
+  |/    () draft
+  | o  6:5568b87b1491 added a
+  | |   () draft
+  | o  5:0a6281e212fe added l
+  |/    () draft
+  | *    4:b9b387427a53 merge commit
+  | |\    () draft
+  +---o  3:9402371b436e added c and d
+  | |     () draft
+  | *  2:a1da0651488c added b
+  | |   () draft
+  | x  1:1b24879c5c3c added a
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft
+
+  $ hg prune -r 9402371b436e --succ 5841d7cf9893 --succ 62fb70414f99 --split
+  1 changesets pruned
+
+  $ hg glog
+  @  8:5841d7cf9893 added d
+  |   () draft
+  | o  7:62fb70414f99 added c
+  |/    () draft
+  | o  6:5568b87b1491 added a
+  | |   () draft
+  | o  5:0a6281e212fe added l
+  |/    () draft
+  | *    4:b9b387427a53 merge commit
+  | |\    () draft
+  +---x  3:9402371b436e added c and d
+  | |     () draft
+  | *  2:a1da0651488c added b
+  | |   () draft
+  | x  1:1b24879c5c3c added a
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft
+
+  $ hg evolve --any --all --dry-run
+  move:[2] added b
+  atop:[6] added a
+  hg rebase -r a1da0651488c -d 5568b87b1491
+  could not solve instability, ambiguous destination: parent split across two branches
+
+  $ hg evolve --any --all --config ui.interactive=True <<EOF
+  > 1
+  > EOF
+  move:[2] added b
+  atop:[6] added a
+  ancestor 'b9b387427a53' split over multiple topological branches.
+  choose an evolve destination:
+  0: [62fb70414f99] added c
+  1: [5841d7cf9893] added d
+  q: quit the prompt
+  enter the index of the revision you want to select: 1
+  move:[4] merge commit
+  atop:[8] added d
+  move:[10] merge commit
+  atop:[9] added b
+  working directory is now at 578c938ebd2e
+
+  $ hg glog
+  @    11:578c938ebd2e merge commit
+  |\    () draft
+  | o  9:da76bb7cd904 added b
+  | |   () draft
+  o |  8:5841d7cf9893 added d
+  | |   () draft
+  +---o  7:62fb70414f99 added c
+  | |     () draft
+  | o  6:5568b87b1491 added a
+  | |   () draft
+  | o  5:0a6281e212fe added l
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft