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

Angel Ezquerra angel.ezquerra at gmail.com
Sun Feb 17 06:19:17 CST 2013


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1360519814 -3600
# Node ID 33063dc38f45ef3a707ddf95f1a716e370315840
# Parent  abbd26cca35280fb8f784b3f2c02eef71696c47b
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
@@ -1059,19 +1059,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