comparison mercurial/hg.py @ 419:28511fc21073

[PATCH] file seperator handling for the other 'OS' -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] file seperator handling for the other 'OS' From: K Thananchayan <thananck@yahoo.com> The following patch maintains repo root relative source file names in canonical form (with '/' as file seperator). Mercurial calls os.path.join, os.path.normpath, os.path.walk that use platform's file seperator. This patch does not change seperator in these circumstances (except when the result refer to source files). manifest hash: 2fbb4cb0d3d0bc4f4de5c7c8803fb738072ec6c5 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuNuBywK+sNU5EO8RAhAZAKCV8cz11+rdof9n1tHb0uDScF34GgCeITNi 4aVikToPXqXyReN9kFP5pnY= =xcV5 -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 21 Jun 2005 19:31:13 -0800
parents 0446f698d38e
children dbe86d465e09
comparison
equal deleted inserted replaced
418:0446f698d38e 419:28511fc21073
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 import sys, struct, os 8 import sys, struct, os
9 import util
9 from revlog import * 10 from revlog import *
10 from demandload import * 11 from demandload import *
11 demandload(globals(), "re lock urllib urllib2 transaction time socket") 12 demandload(globals(), "re lock urllib urllib2 transaction time socket")
12 demandload(globals(), "tempfile httprangereader difflib") 13 demandload(globals(), "tempfile httprangereader difflib")
13 14
387 self.ignorelist = [] 388 self.ignorelist = []
388 try: 389 try:
389 l = file(self.wjoin(".hgignore")) 390 l = file(self.wjoin(".hgignore"))
390 for pat in l: 391 for pat in l:
391 if pat != "\n": 392 if pat != "\n":
392 self.ignorelist.append(re.compile(pat[:-1])) 393 self.ignorelist.append(re.compile(util.pconvert(pat[:-1])))
393 except IOError: pass 394 except IOError: pass
394 for pat in self.ignorelist: 395 for pat in self.ignorelist:
395 if pat.search(f): return True 396 if pat.search(f): return True
396 return False 397 return False
397 398
637 for dir, subdirs, files in os.walk(path): 638 for dir, subdirs, files in os.walk(path):
638 d = dir[len(self.root)+1:] 639 d = dir[len(self.root)+1:]
639 if ".hg" in subdirs: subdirs.remove(".hg") 640 if ".hg" in subdirs: subdirs.remove(".hg")
640 641
641 for f in files: 642 for f in files:
642 fn = os.path.join(d, f) 643 fn = util.pconvert(os.path.join(d, f))
643 try: s = os.stat(os.path.join(self.root, fn)) 644 try: s = os.stat(os.path.join(self.root, fn))
644 except: continue 645 except: continue
645 if fn in dc: 646 if fn in dc:
646 c = dc[fn] 647 c = dc[fn]
647 del dc[fn] 648 del dc[fn]