Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 856:fbe964ae7325
Fixed encoding of directories ending in .d or .i:
One .d and .i was mixed up, and string replace method doesn't work in-place.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 07 Aug 2005 17:41:13 +0100 |
parents | 9c918287d10b |
children | 6390c377a9e6 cbe5c4d016b7 |
comparison
equal
deleted
inserted
replaced
855:a107c64c76be | 856:fbe964ae7325 |
---|---|
20 os.path.join("data", self.encodedir(path + ".d"))) | 20 os.path.join("data", self.encodedir(path + ".d"))) |
21 | 21 |
22 # This avoids a collision between a file named foo and a dir named | 22 # This avoids a collision between a file named foo and a dir named |
23 # foo.i or foo.d | 23 # foo.i or foo.d |
24 def encodedir(self, path): | 24 def encodedir(self, path): |
25 path.replace(".hg/", ".hg.hg/") | 25 return (path |
26 path.replace(".i/", ".i.hg/") | 26 .replace(".hg/", ".hg.hg/") |
27 path.replace(".d/", ".i.hg/") | 27 .replace(".i/", ".i.hg/") |
28 return path | 28 .replace(".d/", ".d.hg/")) |
29 | 29 |
30 def decodedir(self, path): | 30 def decodedir(self, path): |
31 path.replace(".d.hg/", ".d/") | 31 return (path |
32 path.replace(".i.hg/", ".i/") | 32 .replace(".d.hg/", ".d/") |
33 path.replace(".hg.hg/", ".hg/") | 33 .replace(".i.hg/", ".i/") |
34 return path | 34 .replace(".hg.hg/", ".hg/")) |
35 | 35 |
36 def read(self, node): | 36 def read(self, node): |
37 t = self.revision(node) | 37 t = self.revision(node) |
38 if not t.startswith('\1\n'): | 38 if not t.startswith('\1\n'): |
39 return t | 39 return t |