[PATCH] subrepo: don't commit in subrepo if it's clean
Kevin Bullock
kbullock+mercurial at ringworld.org
Tue Jul 19 13:44:32 CDT 2011
# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1311101033 18000
# Branch stable
# Node ID e0eecff0ced05767a72ff36418396147aaf1ee73
# Parent c0ccd70df52cbc361aef372514d61a2fd91f057e
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.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -421,6 +421,10 @@
def commit(self, text, user, date):
self._repo.ui.debug("committing subrepo %s\n" % subrelpath(self))
+ # don't bother committing in the subrepo if it's only been
+ # updated
+ if not self.dirty(True):
+ return self._repo['.'].hex()
n = self._repo.commit(text, user, date)
if not n:
return self._repo['.'].hex() # different version checked out
diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t
--- a/tests/test-mq-subrepo.t
+++ b/tests/test-mq-subrepo.t
@@ -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
More information about the Mercurial-devel
mailing list