hgext/convert/subversion.py
changeset 48913 f254fc73d956
parent 48875 6000f5b25c9b
child 48946 642e31cb55f0
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
   200     protocol = -1
   200     protocol = -1
   201 
   201 
   202     def receiver(orig_paths, revnum, author, date, message, pool):
   202     def receiver(orig_paths, revnum, author, date, message, pool):
   203         paths = {}
   203         paths = {}
   204         if orig_paths is not None:
   204         if orig_paths is not None:
   205             for k, v in pycompat.iteritems(orig_paths):
   205             for k, v in orig_paths.items():
   206                 paths[k] = changedpath(v)
   206                 paths[k] = changedpath(v)
   207         pickle.dump((paths, revnum, author, date, message), fp, protocol)
   207         pickle.dump((paths, revnum, author, date, message), fp, protocol)
   208 
   208 
   209     try:
   209     try:
   210         # Use an ra of our own so that our parent can consume
   210         # Use an ra of our own so that our parent can consume
   295         strict_node_history=False,
   295         strict_node_history=False,
   296     ):
   296     ):
   297         def receiver(orig_paths, revnum, author, date, message, pool):
   297         def receiver(orig_paths, revnum, author, date, message, pool):
   298             paths = {}
   298             paths = {}
   299             if orig_paths is not None:
   299             if orig_paths is not None:
   300                 for k, v in pycompat.iteritems(orig_paths):
   300                 for k, v in orig_paths.items():
   301                     paths[k] = changedpath(v)
   301                     paths[k] = changedpath(v)
   302             self.append((paths, revnum, author, date, message))
   302             self.append((paths, revnum, author, date, message))
   303 
   303 
   304         # Use an ra of our own so that our parent can consume
   304         # Use an ra of our own so that our parent can consume
   305         # our results without confusing the server.
   305         # our results without confusing the server.
   727             entries = svn.client.ls(
   727             entries = svn.client.ls(
   728                 self.baseurl + quote(module), optrev(revnum), True, self.ctx
   728                 self.baseurl + quote(module), optrev(revnum), True, self.ctx
   729             )
   729             )
   730             files = [
   730             files = [
   731                 n
   731                 n
   732                 for n, e in pycompat.iteritems(entries)
   732                 for n, e in entries.items()
   733                 if e.kind == svn.core.svn_node_file
   733                 if e.kind == svn.core.svn_node_file
   734             ]
   734             ]
   735             self.removed = set()
   735             self.removed = set()
   736 
   736 
   737         files.sort()
   737         files.sort()
   817                 origpaths, revnum, author, date, message = entry
   817                 origpaths, revnum, author, date, message = entry
   818                 if not origpaths:
   818                 if not origpaths:
   819                     origpaths = []
   819                     origpaths = []
   820                 copies = [
   820                 copies = [
   821                     (e.copyfrom_path, e.copyfrom_rev, p)
   821                     (e.copyfrom_path, e.copyfrom_rev, p)
   822                     for p, e in pycompat.iteritems(origpaths)
   822                     for p, e in origpaths.items()
   823                     if e.copyfrom_path
   823                     if e.copyfrom_path
   824                 ]
   824                 ]
   825                 # Apply moves/copies from more specific to general
   825                 # Apply moves/copies from more specific to general
   826                 copies.sort(reverse=True)
   826                 copies.sort(reverse=True)
   827 
   827 
   848                 # Here/tags/tag.1 discarded as well as its children.
   848                 # Here/tags/tag.1 discarded as well as its children.
   849                 # It happens with tools like cvs2svn. Such tags cannot
   849                 # It happens with tools like cvs2svn. Such tags cannot
   850                 # be represented in mercurial.
   850                 # be represented in mercurial.
   851                 addeds = {
   851                 addeds = {
   852                     p: e.copyfrom_path
   852                     p: e.copyfrom_path
   853                     for p, e in pycompat.iteritems(origpaths)
   853                     for p, e in origpaths.items()
   854                     if e.action == b'A' and e.copyfrom_path
   854                     if e.action == b'A' and e.copyfrom_path
   855                 }
   855                 }
   856                 badroots = set()
   856                 badroots = set()
   857                 for destroot in addeds:
   857                 for destroot in addeds:
   858                     for source, sourcerev, dest in pendings:
   858                     for source, sourcerev, dest in pendings:
  1137                 return None, branched
  1137                 return None, branched
  1138 
  1138 
  1139             parents = []
  1139             parents = []
  1140             # check whether this revision is the start of a branch or part
  1140             # check whether this revision is the start of a branch or part
  1141             # of a branch renaming
  1141             # of a branch renaming
  1142             orig_paths = sorted(pycompat.iteritems(orig_paths))
  1142             orig_paths = sorted(orig_paths.items())
  1143             root_paths = [
  1143             root_paths = [
  1144                 (p, e) for p, e in orig_paths if self.module.startswith(p)
  1144                 (p, e) for p, e in orig_paths if self.module.startswith(p)
  1145             ]
  1145             ]
  1146             if root_paths:
  1146             if root_paths:
  1147                 path, ent = root_paths[-1]
  1147                 path, ent = root_paths[-1]
  1299         entries = svn.client.ls(rpath, optrev(revnum), True, self.ctx, pool)
  1299         entries = svn.client.ls(rpath, optrev(revnum), True, self.ctx, pool)
  1300         if path:
  1300         if path:
  1301             path += b'/'
  1301             path += b'/'
  1302         return (
  1302         return (
  1303             (path + p)
  1303             (path + p)
  1304             for p, e in pycompat.iteritems(entries)
  1304             for p, e in entries.items()
  1305             if e.kind == svn.core.svn_node_file
  1305             if e.kind == svn.core.svn_node_file
  1306         )
  1306         )
  1307 
  1307 
  1308     def getrelpath(self, path, module=None):
  1308     def getrelpath(self, path, module=None):
  1309         if module is None:
  1309         if module is None: