Mercurial > hg
comparison hgext/convert/p4.py @ 11134:33010ff1fd6f
convert: merge sources getmode() into getfile()
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 09 May 2010 21:52:34 +0200 |
parents | 9f6731b03906 |
children | 18680b0e20a7 |
comparison
equal
deleted
inserted
replaced
11133:d7b6aab612b4 | 11134:33010ff1fd6f |
---|---|
39 self.tags = {} | 39 self.tags = {} |
40 self.lastbranch = {} | 40 self.lastbranch = {} |
41 self.parent = {} | 41 self.parent = {} |
42 self.encoding = "latin_1" | 42 self.encoding = "latin_1" |
43 self.depotname = {} # mapping from local name to depot name | 43 self.depotname = {} # mapping from local name to depot name |
44 self.modecache = {} | |
45 self.re_type = re.compile( | 44 self.re_type = re.compile( |
46 "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)" | 45 "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)" |
47 "(\+\w+)?$") | 46 "(\+\w+)?$") |
48 self.re_keywords = re.compile( | 47 self.re_keywords = re.compile( |
49 r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)" | 48 r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)" |
181 contents += data | 180 contents += data |
182 | 181 |
183 if mode is None: | 182 if mode is None: |
184 raise IOError(0, "bad stat") | 183 raise IOError(0, "bad stat") |
185 | 184 |
186 self.modecache[(name, rev)] = mode | |
187 | |
188 if keywords: | 185 if keywords: |
189 contents = keywords.sub("$\\1$", contents) | 186 contents = keywords.sub("$\\1$", contents) |
190 if mode == "l" and contents.endswith("\n"): | 187 if mode == "l" and contents.endswith("\n"): |
191 contents = contents[:-1] | 188 contents = contents[:-1] |
192 | 189 |
193 return contents | 190 return contents, mode |
194 | |
195 def getmode(self, name, rev): | |
196 return self.modecache[(name, rev)] | |
197 | 191 |
198 def getchanges(self, rev): | 192 def getchanges(self, rev): |
199 return self.files[rev], {} | 193 return self.files[rev], {} |
200 | 194 |
201 def getcommit(self, rev): | 195 def getcommit(self, rev): |