Show More
@@ -0,0 +1,16 b'' | |||
|
1 | # util.py - utility functions and platform specfic implementations | |
|
2 | # | |
|
3 | # Copyright 2005 K. Thananchayan <thananck@yahoo.com> | |
|
4 | # | |
|
5 | # This software may be used and distributed according to the terms | |
|
6 | # of the GNU General Public License, incorporated herein by reference. | |
|
7 | ||
|
8 | import os | |
|
9 | ||
|
10 | if os.name == 'nt': | |
|
11 | def pconvert(path): | |
|
12 | return path.replace("\\", "/") | |
|
13 | else: | |
|
14 | def pconvert(path): | |
|
15 | return path | |
|
16 |
@@ -6,7 +6,7 b'' | |||
|
6 | 6 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | 7 | |
|
8 | 8 | import os, re, sys, signal |
|
9 | import fancyopts, ui, hg | |
|
9 | import fancyopts, ui, hg, util | |
|
10 | 10 | from demandload import * |
|
11 | 11 | demandload(globals(), "mdiff time hgweb traceback random signal errno") |
|
12 | 12 | |
@@ -16,20 +16,20 b' def filterfiles(filters, files):' | |||
|
16 | 16 | l = [ x for x in files if x in filters ] |
|
17 | 17 | |
|
18 | 18 | for t in filters: |
|
19 |
if t and t[-1] != |
|
|
19 | if t and t[-1] != "/": t += "/" | |
|
20 | 20 | l += [ x for x in files if x.startswith(t) ] |
|
21 | 21 | return l |
|
22 | 22 | |
|
23 | 23 | def relfilter(repo, files): |
|
24 | 24 | if os.getcwd() != repo.root: |
|
25 | 25 | p = os.getcwd()[len(repo.root) + 1: ] |
|
26 | return filterfiles([p], files) | |
|
26 | return filterfiles([util.pconvert(p)], files) | |
|
27 | 27 | return files |
|
28 | 28 | |
|
29 | 29 | def relpath(repo, args): |
|
30 | 30 | if os.getcwd() != repo.root: |
|
31 | 31 | p = os.getcwd()[len(repo.root) + 1: ] |
|
32 | return [ os.path.normpath(os.path.join(p, x)) for x in args ] | |
|
32 | return [ util.pconvert(os.path.normpath(os.path.join(p, x))) for x in args ] | |
|
33 | 33 | return args |
|
34 | 34 | |
|
35 | 35 | def dodiff(ui, repo, path, files = None, node1 = None, node2 = None): |
@@ -6,6 +6,7 b'' | |||
|
6 | 6 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | 7 | |
|
8 | 8 | import sys, struct, os |
|
9 | import util | |
|
9 | 10 | from revlog import * |
|
10 | 11 | from demandload import * |
|
11 | 12 | demandload(globals(), "re lock urllib urllib2 transaction time socket") |
@@ -389,7 +390,7 b' class localrepository:' | |||
|
389 | 390 | l = file(self.wjoin(".hgignore")) |
|
390 | 391 | for pat in l: |
|
391 | 392 | if pat != "\n": |
|
392 | self.ignorelist.append(re.compile(pat[:-1])) | |
|
393 | self.ignorelist.append(re.compile(util.pconvert(pat[:-1]))) | |
|
393 | 394 | except IOError: pass |
|
394 | 395 | for pat in self.ignorelist: |
|
395 | 396 | if pat.search(f): return True |
@@ -639,7 +640,7 b' class localrepository:' | |||
|
639 | 640 | if ".hg" in subdirs: subdirs.remove(".hg") |
|
640 | 641 | |
|
641 | 642 | for f in files: |
|
642 | fn = os.path.join(d, f) | |
|
643 | fn = util.pconvert(os.path.join(d, f)) | |
|
643 | 644 | try: s = os.stat(os.path.join(self.root, fn)) |
|
644 | 645 | except: continue |
|
645 | 646 | if fn in dc: |
General Comments 0
You need to be logged in to leave comments.
Login now