# HG changeset patch # User Matt Mackall # Date 2008-06-26 19:35:50 # Node ID 51b0e799352fa4c2254c9add438c8b72255689ce # Parent c6cc35a3d1de1e4f3ce4bf57690e2b41120e92ea manifest: remove execf/linkf methods diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -229,8 +229,7 @@ class mercurial_source(converter_source) raise IOError(err) def getmode(self, name, rev): - m = self.changectx(rev).manifest() - return (m.execf(name) and 'x' or '') + (m.linkf(name) and 'l' or '') + return self.changectx(rev).manifest().flags(name) def getchanges(self, rev): ctx = self.changectx(rev) diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -163,11 +163,11 @@ class kwtemplater(object): return self.substitute(data, path, changenode, self.re_kw.sub) return data - def iskwfile(self, path, islink): + def iskwfile(self, path, flagfunc): '''Returns true if path matches [keyword] pattern and is not a symbolic link. Caveat: localrepository._link fails on Windows.''' - return self.matcher(path) and not islink(path) + return self.matcher(path) and not 'l' in flagfunc(path) def overwrite(self, node, expand, files): '''Overwrites selected files expanding/shrinking keywords.''' @@ -178,9 +178,8 @@ class kwtemplater(object): notify = self.ui.debug else: # kwexpand/kwshrink ctx = self.repo['.'] - mf = ctx.manifest() notify = self.ui.note - candidates = [f for f in files if self.iskwfile(f, mf.linkf)] + candidates = [f for f in files if self.iskwfile(f, ctx.flags)] if candidates: self.restrict = True # do not expand when reading candidates.sort() @@ -387,8 +386,7 @@ def files(ui, repo, *pats, **opts): files += unknown files.sort() wctx = repo[None] - islink = lambda p: 'l' in wctx.flags(p) - kwfiles = [f for f in files if kwt.iskwfile(f, islink)] + kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)] cwd = pats and repo.getcwd() or '' kwfstats = not opts.get('ignore') and (('K', kwfiles),) or () if opts.get('all') or opts.get('ignore'): diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -208,18 +208,17 @@ def archive(repo, dest, node, kind, deco data = repo.wwritedata(name, data) archiver.addfile(name, mode, islink, data) - ctx = repo[node] if kind not in archivers: raise util.Abort(_("unknown archive type '%s'" % kind)) + + ctx = repo[node] archiver = archivers[kind](dest, prefix, mtime or ctx.date()[0]) - m = ctx.manifest() - items = m.items() - items.sort() + if repo.ui.configbool("ui", "archivemeta", True): write('.hg_archival.txt', 0644, False, lambda: 'repo: %s\nnode: %s\n' % ( hex(repo.changelog.node(0)), hex(node))) - for filename, filenode in items: - write(filename, m.execf(filename) and 0755 or 0644, m.linkf(filename), - lambda: repo.file(filename).read(filenode)) + for f in ctx: + ff = ctx.flags(f) + write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) archiver.done() diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1866,17 +1866,13 @@ def manifest(ui, repo, node=None, rev=No if not node: node = rev - m = repo[node].manifest() - files = m.keys() - files.sort() - - for f in files: + decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '} + ctx = repo[node] + for f in ctx: if ui.debugflag: - ui.write("%40s " % hex(m[f])) + ui.write("%40s " % hex(ctx.manifest()[f])) if ui.verbose: - type = m.execf(f) and "*" or m.linkf(f) and "@" or " " - perm = m.execf(f) and "755" or "644" - ui.write("%3s %1s " % (perm, type)) + ui.write(decor[ctx.flags(f)]) ui.write("%s\n" % f) def merge(ui, repo, node=None, force=None, rev=None): diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -384,7 +384,7 @@ class dirstate(object): def rebuild(self, parent, files): self.clear() for f in files: - if files.execf(f): + if 'x' in files.flag(f): self._map[f] = ('n', 0777, -1, 0, 0) else: self._map[f] = ('n', 0666, -1, 0, 0) diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -18,12 +18,6 @@ class manifestdict(dict): self._flags = flags def flags(self, f): return self._flags.get(f, "") - def execf(self, f): - "test for executable in manifest flags" - return "x" in self.flags(f) - def linkf(self, f): - "test for symlink in manifest flags" - return "l" in self.flags(f) def set(self, f, flags): self._flags[f] = flags def copy(self):