diff mercurial/commands.py @ 885:6594ba2a0f51

Merge latest round of walk fixes.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 12 Aug 2005 11:18:41 -0800
parents 781266a78fe1 087771ebe2e6
children 882756761433
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Aug 12 10:17:12 2005 -0800
+++ b/mercurial/commands.py	Fri Aug 12 11:18:41 2005 -0800
@@ -40,22 +40,12 @@
     return util.matcher(repo, cwd, pats or ['.'], opts.get('include'),
                         opts.get('exclude'), head)
 
-def pathto(n1, n2):
-    '''return the relative path from one place to another'''
-    if not n1: return n2
-    a, b = n1.split(os.sep), n2.split(os.sep)
-    a.reverse(), b.reverse()
-    while a and b and a[-1] == b[-1]:
-        a.pop(), b.pop()
-    b.reverse()
-    return os.sep.join((['..'] * len(a)) + b)
-
 def makewalk(repo, pats, opts, head = ''):
     cwd = repo.getcwd()
     files, matchfn = matchpats(repo, cwd, pats, opts, head)
     def walk():
         for src, fn in repo.walk(files = files, match = matchfn):
-            yield src, fn, pathto(cwd, fn)
+            yield src, fn, util.pathto(cwd, fn)
     return files, matchfn, walk()
 
 def walk(repo, pats, opts, head = ''):
@@ -1078,7 +1068,7 @@
 
     cwd = repo.getcwd()
     files, matchfn = matchpats(repo, cwd, pats, opts)
-    (c, a, d, u) = [[pathto(cwd, x) for x in n]
+    (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
                     for n in repo.changes(files=files, match=matchfn)]
 
     changetypes = [('modified', 'M', c),