hgext/convert/__init__.py
changeset 5374 e710874247d1
parent 5373 6aba1835a7b3
child 5375 dae323e453aa
equal deleted inserted replaced
5373:6aba1835a7b3 5374:e710874247d1
     3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
     3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
     4 #
     4 #
     5 # This software may be used and distributed according to the terms
     5 # This software may be used and distributed according to the terms
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 
     7 
     8 from common import NoRepo, converter_source, converter_sink
     8 from common import NoRepo, SKIPREV, converter_source, converter_sink
     9 from cvs import convert_cvs
     9 from cvs import convert_cvs
    10 from darcs import darcs_source
    10 from darcs import darcs_source
    11 from git import convert_git
    11 from git import convert_git
    12 from hg import mercurial_source, mercurial_sink
    12 from hg import mercurial_source, mercurial_sink
    13 from subversion import convert_svn, debugsvnlog
    13 from subversion import convert_svn, debugsvnlog
   200     def copy(self, rev):
   200     def copy(self, rev):
   201         commit = self.commitcache[rev]
   201         commit = self.commitcache[rev]
   202         do_copies = hasattr(self.dest, 'copyfile')
   202         do_copies = hasattr(self.dest, 'copyfile')
   203         filenames = []
   203         filenames = []
   204 
   204 
   205         files, copies = self.source.getchanges(rev)
   205         changes = self.source.getchanges(rev)
       
   206         if isinstance(changes, basestring):
       
   207             if changes == SKIPREV:
       
   208                 dest = SKIPREV
       
   209             else:
       
   210                 dest = self.map[changes]
       
   211             self.mapentry(rev, dest)
       
   212             return
       
   213         files, copies = changes
   206         parents = [self.map[r] for r in commit.parents]
   214         parents = [self.map[r] for r in commit.parents]
   207         if commit.parents:
   215         if commit.parents:
   208             prev = commit.parents[0]
   216             prev = commit.parents[0]
   209             if prev not in self.commitcache:
   217             if prev not in self.commitcache:
   210                 self.cachecommit(prev)
   218                 self.cachecommit(prev)
   261 
   269 
   262             tags = self.source.gettags()
   270             tags = self.source.gettags()
   263             ctags = {}
   271             ctags = {}
   264             for k in tags:
   272             for k in tags:
   265                 v = tags[k]
   273                 v = tags[k]
   266                 if v in self.map:
   274                 if self.map.get(v, SKIPREV) != SKIPREV:
   267                     ctags[k] = self.map[v]
   275                     ctags[k] = self.map[v]
   268 
   276 
   269             if c and ctags:
   277             if c and ctags:
   270                 nrev = self.dest.puttags(ctags)
   278                 nrev = self.dest.puttags(ctags)
   271                 # write another hash correspondence to override the previous
   279                 # write another hash correspondence to override the previous