changeset 14898:95ced9f5bf29 stable

subrepo: don't commit in subrepo if it's clean If a subrepo has changed relative to the outer repo's substate, but the subrepo itself is clean, we don't need to commit in the subrepo.
author Kevin Bullock <kbullock@ringworld.org>
date Tue, 19 Jul 2011 13:43:53 -0500
parents b9daa5b7a3af
children 6d1d0b9c4ecc a934b9249574
files mercurial/subrepo.py tests/test-mq-subrepo.t
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Mon Jul 18 22:58:21 2011 +0200
+++ b/mercurial/subrepo.py	Tue Jul 19 13:43:53 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	Mon Jul 18 22:58:21 2011 +0200
+++ b/tests/test-mq-subrepo.t	Tue Jul 19 13:43:53 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