mercurial/copies.py
changeset 25282 0f28815ef066
parent 24782 4906dc0e038c
child 25288 947771ad5174
equal deleted inserted replaced
25281:660b178f49c7 25282:0f28815ef066
     3 # Copyright 2008 Matt Mackall <mpm@selenic.com>
     3 # Copyright 2008 Matt Mackall <mpm@selenic.com>
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 import util
     8 import util, pathutil
     9 import heapq
     9 import heapq
    10 
       
    11 def _dirname(f):
       
    12     s = f.rfind("/")
       
    13     if s == -1:
       
    14         return ""
       
    15     return f[:s]
       
    16 
    10 
    17 def _findlimit(repo, a, b):
    11 def _findlimit(repo, a, b):
    18     """
    12     """
    19     Find the last revision that needs to be checked to ensure that a full
    13     Find the last revision that needs to be checked to ensure that a full
    20     transitive closure for file copies can be properly calculated.
    14     transitive closure for file copies can be properly calculated.
   382     dirmove = {}
   376     dirmove = {}
   383 
   377 
   384     # examine each file copy for a potential directory move, which is
   378     # examine each file copy for a potential directory move, which is
   385     # when all the files in a directory are moved to a new directory
   379     # when all the files in a directory are moved to a new directory
   386     for dst, src in fullcopy.iteritems():
   380     for dst, src in fullcopy.iteritems():
   387         dsrc, ddst = _dirname(src), _dirname(dst)
   381         dsrc, ddst = pathutil.dirname(src), pathutil.dirname(dst)
   388         if dsrc in invalid:
   382         if dsrc in invalid:
   389             # already seen to be uninteresting
   383             # already seen to be uninteresting
   390             continue
   384             continue
   391         elif dsrc in d1 and ddst in d1:
   385         elif dsrc in d1 and ddst in d1:
   392             # directory wasn't entirely moved locally
   386             # directory wasn't entirely moved locally