Commits

Martin Vejnár  committed 1b9e154

It is now possible to use tags as a target revision in 'dep' command.

scm_*.fetch() returns translated revision, which
is then used as a parameter to update.

  • Participants
  • Parent commits f211dc9

Comments (0)

Files changed (1)

             
             for dependency in deplist:
                 scmhandler = _get_scm_handler(ui, repo, manifest, dependency.alias, config.aliases)
-                scmhandler.fetch(config.aliases, dependency.rev)
-                scmhandler.update(dependency.rev)
+                realrev = scmhandler.fetch(config.aliases, dependency.rev)
+                scmhandler.update(realrev)
                 scmhandler.move(dependency.dest)
         finally:
             manifest.save(repo)
             
             if rev is not None:
                 ui.debug("fetching dependency to version: %s\n" % rev)
-                scmhandler.fetch(config.aliases, rev)
-                ui.debug("updating dependency to version: %s\n" % rev)
-                scmhandler.update(rev)
+                realrev = scmhandler.fetch(config.aliases, rev)
+                ui.debug("updating dependency to version: %s\n" % realrev)
+                scmhandler.update(realrev)
             elif alias_name not in manifest:
                 raise util.Abort(_('unfetched dependency: %s (specify revision to update to)')
                     % alias_name)
     
     def fetch(self, aliases, rev):
         self.alias = aliases[self.alias_name]
+        return rev
     
     def update(self, rev):
         raise util.Abort(_('cannot update a dependency of unknown type: %s, %s')
         deprepo = localrepo.localrepository(self.ui, path, create)
         self.manifest.set(self.alias_name, 'hg', '-', dir)
         
-        need_pull = True
         try:
-            deprepo.lookup(rev)
-            need_pull = False
+            rev = mercurial.node.hex(deprepo.lookup(rev))
+            return rev
         except mercurial.revlog.LookupError:
             pass
         except RepoError:
             pass
         
-        if need_pull:
-            self.ui.debug(_('fetching changesets for dependency: %s up to: %s\n')
-                % (self.alias_name, rev))
-            alias = aliases[self.alias_name]
-            if alias.scmtype != 'hg':
-                raise util.Abort(_('scmtype mismatch (try running "hg deppurge %s")')
-                    % alias.name)
-            otherrepo = hg.repository(self.ui, alias.location)
-            targetnode = otherrepo.lookup(rev)
-            deprepo.pull(otherrepo, heads=[targetnode])
+        # Lookup failed in the local repository,
+        # it is necessary to pull the changes from
+        # remote location.
+        self.ui.debug(_('fetching changesets for dependency: %s up to: %s\n')
+            % (self.alias_name, rev))
+        alias = aliases[self.alias_name]
+        if alias.scmtype != 'hg':
+            raise util.Abort(_('scmtype mismatch (try running "hg deppurge %s")')
+                % alias.name)
+        otherrepo = hg.repository(self.ui, alias.location)
+        targetnode = otherrepo.lookup(rev)
+        deprepo.pull(otherrepo, heads=[targetnode])
+        return mercurial.node.hex(targetnode)
     
     def update(self, rev):
         dir = self.manifest.get_dir(self.alias_name)