Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.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 | f2d1f5fd0179 |
children | 688d03d6997a |
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 os, re, sys, signal | 8 import os, re, sys, signal |
9 import fancyopts, ui, hg | 9 import fancyopts, ui, hg, util |
10 from demandload import * | 10 from demandload import * |
11 demandload(globals(), "mdiff time hgweb traceback random signal errno") | 11 demandload(globals(), "mdiff time hgweb traceback random signal errno") |
12 | 12 |
13 class UnknownCommand(Exception): pass | 13 class UnknownCommand(Exception): pass |
14 | 14 |
15 def filterfiles(filters, files): | 15 def filterfiles(filters, files): |
16 l = [ x for x in files if x in filters ] | 16 l = [ x for x in files if x in filters ] |
17 | 17 |
18 for t in filters: | 18 for t in filters: |
19 if t and t[-1] != os.sep: t += os.sep | 19 if t and t[-1] != "/": t += "/" |
20 l += [ x for x in files if x.startswith(t) ] | 20 l += [ x for x in files if x.startswith(t) ] |
21 return l | 21 return l |
22 | 22 |
23 def relfilter(repo, files): | 23 def relfilter(repo, files): |
24 if os.getcwd() != repo.root: | 24 if os.getcwd() != repo.root: |
25 p = os.getcwd()[len(repo.root) + 1: ] | 25 p = os.getcwd()[len(repo.root) + 1: ] |
26 return filterfiles([p], files) | 26 return filterfiles([util.pconvert(p)], files) |
27 return files | 27 return files |
28 | 28 |
29 def relpath(repo, args): | 29 def relpath(repo, args): |
30 if os.getcwd() != repo.root: | 30 if os.getcwd() != repo.root: |
31 p = os.getcwd()[len(repo.root) + 1: ] | 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 return args | 33 return args |
34 | 34 |
35 def dodiff(ui, repo, path, files = None, node1 = None, node2 = None): | 35 def dodiff(ui, repo, path, files = None, node1 = None, node2 = None): |
36 def date(c): | 36 def date(c): |
37 return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) | 37 return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) |