##// END OF EJS Templates
manifest: remove execf/linkf methods
Matt Mackall -
r6749:51b0e799 default
parent child Browse files
Show More
@@ -229,8 +229,7 b' class mercurial_source(converter_source)'
229 229 raise IOError(err)
230 230
231 231 def getmode(self, name, rev):
232 m = self.changectx(rev).manifest()
233 return (m.execf(name) and 'x' or '') + (m.linkf(name) and 'l' or '')
232 return self.changectx(rev).manifest().flags(name)
234 233
235 234 def getchanges(self, rev):
236 235 ctx = self.changectx(rev)
@@ -163,11 +163,11 b' class kwtemplater(object):'
163 163 return self.substitute(data, path, changenode, self.re_kw.sub)
164 164 return data
165 165
166 def iskwfile(self, path, islink):
166 def iskwfile(self, path, flagfunc):
167 167 '''Returns true if path matches [keyword] pattern
168 168 and is not a symbolic link.
169 169 Caveat: localrepository._link fails on Windows.'''
170 return self.matcher(path) and not islink(path)
170 return self.matcher(path) and not 'l' in flagfunc(path)
171 171
172 172 def overwrite(self, node, expand, files):
173 173 '''Overwrites selected files expanding/shrinking keywords.'''
@@ -178,9 +178,8 b' class kwtemplater(object):'
178 178 notify = self.ui.debug
179 179 else: # kwexpand/kwshrink
180 180 ctx = self.repo['.']
181 mf = ctx.manifest()
182 181 notify = self.ui.note
183 candidates = [f for f in files if self.iskwfile(f, mf.linkf)]
182 candidates = [f for f in files if self.iskwfile(f, ctx.flags)]
184 183 if candidates:
185 184 self.restrict = True # do not expand when reading
186 185 candidates.sort()
@@ -387,8 +386,7 b' def files(ui, repo, *pats, **opts):'
387 386 files += unknown
388 387 files.sort()
389 388 wctx = repo[None]
390 islink = lambda p: 'l' in wctx.flags(p)
391 kwfiles = [f for f in files if kwt.iskwfile(f, islink)]
389 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
392 390 cwd = pats and repo.getcwd() or ''
393 391 kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
394 392 if opts.get('all') or opts.get('ignore'):
@@ -208,18 +208,17 b' def archive(repo, dest, node, kind, deco'
208 208 data = repo.wwritedata(name, data)
209 209 archiver.addfile(name, mode, islink, data)
210 210
211 ctx = repo[node]
212 211 if kind not in archivers:
213 212 raise util.Abort(_("unknown archive type '%s'" % kind))
213
214 ctx = repo[node]
214 215 archiver = archivers[kind](dest, prefix, mtime or ctx.date()[0])
215 m = ctx.manifest()
216 items = m.items()
217 items.sort()
216
218 217 if repo.ui.configbool("ui", "archivemeta", True):
219 218 write('.hg_archival.txt', 0644, False,
220 219 lambda: 'repo: %s\nnode: %s\n' % (
221 220 hex(repo.changelog.node(0)), hex(node)))
222 for filename, filenode in items:
223 write(filename, m.execf(filename) and 0755 or 0644, m.linkf(filename),
224 lambda: repo.file(filename).read(filenode))
221 for f in ctx:
222 ff = ctx.flags(f)
223 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data)
225 224 archiver.done()
@@ -1866,17 +1866,13 b' def manifest(ui, repo, node=None, rev=No'
1866 1866 if not node:
1867 1867 node = rev
1868 1868
1869 m = repo[node].manifest()
1870 files = m.keys()
1871 files.sort()
1872
1873 for f in files:
1869 decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '}
1870 ctx = repo[node]
1871 for f in ctx:
1874 1872 if ui.debugflag:
1875 ui.write("%40s " % hex(m[f]))
1873 ui.write("%40s " % hex(ctx.manifest()[f]))
1876 1874 if ui.verbose:
1877 type = m.execf(f) and "*" or m.linkf(f) and "@" or " "
1878 perm = m.execf(f) and "755" or "644"
1879 ui.write("%3s %1s " % (perm, type))
1875 ui.write(decor[ctx.flags(f)])
1880 1876 ui.write("%s\n" % f)
1881 1877
1882 1878 def merge(ui, repo, node=None, force=None, rev=None):
@@ -384,7 +384,7 b' class dirstate(object):'
384 384 def rebuild(self, parent, files):
385 385 self.clear()
386 386 for f in files:
387 if files.execf(f):
387 if 'x' in files.flag(f):
388 388 self._map[f] = ('n', 0777, -1, 0, 0)
389 389 else:
390 390 self._map[f] = ('n', 0666, -1, 0, 0)
@@ -18,12 +18,6 b' class manifestdict(dict):'
18 18 self._flags = flags
19 19 def flags(self, f):
20 20 return self._flags.get(f, "")
21 def execf(self, f):
22 "test for executable in manifest flags"
23 return "x" in self.flags(f)
24 def linkf(self, f):
25 "test for symlink in manifest flags"
26 return "l" in self.flags(f)
27 21 def set(self, f, flags):
28 22 self._flags[f] = flags
29 23 def copy(self):
General Comments 0
You need to be logged in to leave comments. Login now