merge with stable
authorMatt Mackall <mpm@selenic.com>
Tue, 19 Jul 2011 17:51:45 -0500
changeset 14899 6d1d0b9c4ecc
parent 14896 1a841d2b4bb1 (current diff)
parent 14898 95ced9f5bf29 (diff)
child 14900 fc3d6f300d7d
merge with stable
--- a/hgext/rebase.py	Tue Jul 19 14:19:04 2011 -0500
+++ b/hgext/rebase.py	Tue Jul 19 17:51:45 2011 -0500
@@ -175,6 +175,14 @@
             assert not extrafn, 'cannot use both keepbranches and extrafn'
             def extrafn(ctx, extra):
                 extra['branch'] = ctx.branch()
+            if collapsef:
+                branches = set()
+                for rev in state:
+                    branches.add(repo[rev].branch())
+                    if len(branches) > 1:
+                        raise util.Abort(_('cannot collapse multiple named ' 
+                            'branches'))
+
 
         # Rebase
         if not targetancestors:
--- a/mercurial/subrepo.py	Tue Jul 19 14:19:04 2011 -0500
+++ b/mercurial/subrepo.py	Tue Jul 19 17:51:45 2011 -0500
@@ -420,6 +420,10 @@
         return self._repo._checknested(self._repo.wjoin(path))
 
     def commit(self, text, user, date):
+        # don't bother committing in the subrepo if it's only been
+        # updated
+        if not self.dirty(True):
+            return self._repo['.'].hex()
         self._repo.ui.debug("committing subrepo %s\n" % subrelpath(self))
         n = self._repo.commit(text, user, date)
         if not n:
--- a/tests/test-mq-subrepo.t	Tue Jul 19 14:19:04 2011 -0500
+++ b/tests/test-mq-subrepo.t	Tue Jul 19 17:51:45 2011 -0500
@@ -348,3 +348,14 @@
   % debugsub should be empty
 
   $ cd ..
+
+
+correctly handle subrepos with patch queues
+  $ mkrepo repo-subrepo-with-queue
+  $ mksubrepo sub
+  adding a
+  $ hg -R sub qnew sub0.diff
+  $ echo sub = sub >> .hgsub
+  $ hg add .hgsub
+  $ hg qnew 0.diff
+  committing subrepository sub
--- a/tests/test-rebase-collapse.t	Tue Jul 19 14:19:04 2011 -0500
+++ b/tests/test-rebase-collapse.t	Tue Jul 19 17:51:45 2011 -0500
@@ -442,3 +442,41 @@
   D
   F
 
+Interactions between collapse and keepbranches
+  $ cd ..
+  $ hg init e
+  $ cd e
+  $ echo 'a' > a
+  $ hg ci -Am 'A'
+  adding a
+
+  $ hg branch '1'
+  marked working directory as branch 1
+  $ echo 'b' > b
+  $ hg ci -Am 'B'
+  adding b
+
+  $ hg branch '2'
+  marked working directory as branch 2
+  $ echo 'c' > c
+  $ hg ci -Am 'C'
+  adding c
+
+  $ hg up -q 0
+  $ echo 'd' > d
+  $ hg ci -Am 'D'
+  adding d
+
+  $ hg tglog
+  @  3: 'D'
+  |
+  | o  2: 'C' 2
+  | |
+  | o  1: 'B' 1
+  |/
+  o  0: 'A'
+  
+  $ hg rebase --keepbranches --collapse -s 1 -d 3
+  abort: cannot collapse multiple named branches
+  [255]
+