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

login
register
mail settings
Submitter Angel Ezquerra
Date March 3, 2013, 9:05 p.m.
Message ID <191273cb15a13cab7fef.1362344746@Angel-PC.localdomain>
Download mbox | patch
Permalink /patch/1076/
State Rejected, archived
Headers show

Comments

Angel Ezquerra - March 3, 2013, 9:05 p.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@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.

Patch

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))