[PATCH] subrepo: don't push mercurial subrepositories unless necessary (issue3867)
Nathan Hoad
nathan at getoffmalawn.com
Mon Mar 25 17:45:49 CDT 2013
# HG changeset patch
# User Nathan Hoad <nathan at getoffmalawn.com>
# Date 1364251459 -39600
# Node ID 02259346e572480c53b47b01b6f12a2227bb75d2
# Parent af9ddea2cb99b6e4314a6e79b793b5fc30ea4f19
subrepo: don't push mercurial subrepositories unless necessary (issue3867)
When I try to push a repository containing a mixture of mercurial and git
subrepositories, mercurial always attempts to push the mercurial subrepos,
instead of only pushing if necessary.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -9,6 +9,7 @@ import errno, os, re, xml.dom.minidom, s
import stat, subprocess, tarfile
from i18n import _
import config, scmutil, util, node, error, cmdutil, bookmarks, match as matchmod
+import discovery
hg = None
propertycache = util.propertycache
@@ -599,9 +600,18 @@ class hgsubrepo(abstractsubrepo):
return False
dsturl = _abssource(self._repo, True)
+
+ other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
+
+ if not force:
+ outgoing = discovery.findcommonoutgoing(self._repo, other)
+ if not len(outgoing.missing):
+ self._repo.ui.status(_('nothing to push for %s\n') %
+ subrepo.subrelpath(self))
+ return True
+
self._repo.ui.status(_('pushing subrepo %s to %s\n') %
(subrelpath(self), dsturl))
- other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
return self._repo.push(other, force, newbranch=newbranch)
@annotatesubrepoerror
More information about the Mercurial-devel
mailing list