[PATCH 2 of 5 V2] subrepo: add pull --subrepos support to git subrepos

Angel Ezquerra angel.ezquerra at gmail.com
Sun Mar 3 15:05:46 CST 2013


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1360519814 -3600
# Node ID 191273cb15a13cab7fef24a5b8404f8302e09395
# Parent  c5e164d3282a4a2fb54171e6246b3b2e8a520080
subrepo: add pull --subrepos support to git subrepos

Note that I am not a git subrepo user myself so please review this carefully.

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1060,19 +1060,22 @@
         self._subsource = source
         return _abssource(self)
 
+    def pull(self, source):
+        self._fetch(source, None)
+
     def _fetch(self, source, revision):
         if self._gitmissing():
             source = self._abssource(source)
             self._ui.status(_('cloning subrepo %s from %s\n') %
                             (self._relpath, source))
             self._gitnodir(['clone', source, self._abspath])
-        if self._githavelocally(revision):
+        if revision is not None and self._githavelocally(revision):
             return
         self._ui.status(_('pulling subrepo %s from %s\n') %
                         (self._relpath, self._gitremote('origin')))
         # try only origin: the originally cloned repo
         self._gitcommand(['fetch'])
-        if not self._githavelocally(revision):
+        if revision is not None and not self._githavelocally(revision):
             raise util.Abort(_("revision %s does not exist in subrepo %s\n") %
                                (revision, self._relpath))
 


More information about the Mercurial-devel mailing list