Commits

Martin Vejnár committed 1579989

Added the ability to override the fetch source location in 'hg dep'.

  • Participants
  • Parent commits 951f493

Comments (0)

Files changed (1)

     finally:
         wlock.release()
 
-def dep(ui, repo, alias_name, dest, rev=None):
+def dep(ui, repo, alias_name, dest, rev=None, source=None):
     '''fetch or move a dependency to a specified destination
     
     Updates the dependency to a given revision and moves it to
             
             if rev is not None:
                 ui.debug("fetching dependency to version: %s\n" % rev)
-                realrev = scmhandler.fetch(config.aliases, rev)
+                realrev = scmhandler.fetch(config.aliases, rev, source)
                 ui.debug("updating dependency to version: %s\n" % realrev)
                 scmhandler.update(realrev)
             elif alias_name not in manifest:
         return rev
     readable_rev = staticmethod(readable_rev)
     
-    def fetch(self, aliases, rev):
+    def fetch(self, aliases, rev, source=None):
         self.alias = aliases[self.alias_name]
         return rev
     
         return ','.join(nodeid[:12] for nodeid in revision.split(','))
     readable_rev = staticmethod(readable_rev)
 
-    def fetch(self, aliases, rev):
+    def fetch(self, aliases, rev, source=None):
         dir = self.manifest.get_dir(self.alias_name)
         path = self._make_deppath(dir)
         
         if alias.scmtype != 'hg':
             raise util.Abort(_('scmtype mismatch (try running "hg deppurge %s")')
                 % alias.name)
-        otherrepo = hg.repository(self.ui, alias.location)
+        otherrepo = hg.repository(self.ui, source or alias.location)
         targetnode = otherrepo.lookup(rev)
         deprepo.pull(otherrepo, heads=[targetnode])
         return mercurial.node.hex(targetnode)
     'deprmalias':
         (deprmalias, [], 'ALIAS'),
 
-    'dep': (dep, [], 'ALIAS DEST [REV]'),
+    'dep':
+        (dep, [
+            ('s', 'source', '', 'override remote repository location'),
+        ], '[-s SOURCE] ALIAS DEST [REV]'),
+    
     'depremove|deprm': (depremove, [], 'ALIAS...'),
     'deppurge': (deppurge, [], '[ALIAS]...'),
 }