##// END OF EJS Templates
Merge Windows path fixes.
Bryan O'Sullivan -
r887:88275676 merge default
parent child Browse files
Show More
@@ -32,8 +32,7 b' def relfilter(repo, files):'
32 def relpath(repo, args):
32 def relpath(repo, args):
33 cwd = repo.getcwd()
33 cwd = repo.getcwd()
34 if cwd:
34 if cwd:
35 return [util.pconvert(os.path.normpath(os.path.join(cwd, x)))
35 return [util.normpath(os.path.join(cwd, x)) for x in args]
36 for x in args]
37 return args
36 return args
38
37
39 def matchpats(repo, cwd, pats = [], opts = {}, head = ''):
38 def matchpats(repo, cwd, pats = [], opts = {}, head = ''):
@@ -312,14 +312,14 b' class dirstate:'
312 l = file(self.wjoin(".hgignore"))
312 l = file(self.wjoin(".hgignore"))
313 for pat in l:
313 for pat in l:
314 if pat != "\n":
314 if pat != "\n":
315 p = util.pconvert(pat[:-1])
315 p = pat[:-1]
316 try:
316 try:
317 r = re.compile(p)
317 re.compile(p)
318 except:
318 except:
319 self.ui.warn("ignoring invalid ignore"
319 self.ui.warn("ignoring invalid ignore"
320 + " regular expression '%s'\n" % p)
320 + " regular expression '%s'\n" % p)
321 else:
321 else:
322 bigpat.append(util.pconvert(pat[:-1]))
322 bigpat.append(p)
323 except IOError: pass
323 except IOError: pass
324
324
325 if bigpat:
325 if bigpat:
@@ -501,7 +501,7 b' class dirstate:'
501 if stat.S_ISDIR(st.st_mode):
501 if stat.S_ISDIR(st.st_mode):
502 for dir, subdirs, fl in os.walk(f):
502 for dir, subdirs, fl in os.walk(f):
503 d = dir[len(self.root) + 1:]
503 d = dir[len(self.root) + 1:]
504 nd = os.path.normpath(d)
504 nd = util.normpath(d)
505 if seen(nd):
505 if seen(nd):
506 subdirs[:] = []
506 subdirs[:] = []
507 continue
507 continue
@@ -536,7 +536,7 b' class dirstate:'
536 # not in .hgignore
536 # not in .hgignore
537
537
538 for src, fn in util.unique(traverse()):
538 for src, fn in util.unique(traverse()):
539 fn = os.path.normpath(fn)
539 fn = util.normpath(fn)
540 if seen(fn): continue
540 if seen(fn): continue
541 if fn not in dc and self.ignore(fn):
541 if fn not in dc and self.ignore(fn):
542 continue
542 continue
@@ -70,9 +70,10 b" def globre(pat, head = '^', tail = '$'):"
70 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1}
70 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1}
71
71
72 def pathto(n1, n2):
72 def pathto(n1, n2):
73 '''return the relative path from one place to another'''
73 '''return the relative path from one place to another.
74 if not n1: return n2
74 this returns a path in the form used by the local filesystem, not hg.'''
75 a, b = n1.split(os.sep), n2.split(os.sep)
75 if not n1: return localpath(n2)
76 a, b = n1.split('/'), n2.split('/')
76 a.reverse(), b.reverse()
77 a.reverse(), b.reverse()
77 while a and b and a[-1] == b[-1]:
78 while a and b and a[-1] == b[-1]:
78 a.pop(), b.pop()
79 a.pop(), b.pop()
@@ -86,7 +87,7 b' def canonpath(repo, cwd, myname):'
86 name = os.path.join(repo.root, cwd, name)
87 name = os.path.join(repo.root, cwd, name)
87 name = os.path.normpath(name)
88 name = os.path.normpath(name)
88 if name.startswith(rootsep):
89 if name.startswith(rootsep):
89 return name[len(rootsep):]
90 return pconvert(name[len(rootsep):])
90 elif name == repo.root:
91 elif name == repo.root:
91 return ''
92 return ''
92 else:
93 else:
@@ -121,7 +122,7 b' def matcher(repo, cwd, names, inc, exc, '
121 for p in pat.split(os.sep):
122 for p in pat.split(os.sep):
122 if patkind(p)[0] == 'glob': break
123 if patkind(p)[0] == 'glob': break
123 root.append(p)
124 root.append(p)
124 return os.sep.join(root)
125 return '/'.join(root)
125
126
126 pats = []
127 pats = []
127 files = []
128 files = []
@@ -204,6 +205,12 b" if os.name == 'nt':"
204 def pconvert(path):
205 def pconvert(path):
205 return path.replace("\\", "/")
206 return path.replace("\\", "/")
206
207
208 def localpath(path):
209 return path.replace('/', '\\')
210
211 def normpath(path):
212 return pconvert(os.path.normpath(path))
213
207 makelock = _makelock_file
214 makelock = _makelock_file
208 readlock = _readlock_file
215 readlock = _readlock_file
209
216
@@ -232,6 +239,11 b' else:'
232 def pconvert(path):
239 def pconvert(path):
233 return path
240 return path
234
241
242 def localpath(path):
243 return path
244
245 normpath = os.path.normpath
246
235 def makelock(info, pathname):
247 def makelock(info, pathname):
236 try:
248 try:
237 os.symlink(info, pathname)
249 os.symlink(info, pathname)
General Comments 0
You need to be logged in to leave comments. Login now