# HG changeset patch # User Alexis S. L. Carvalho # Date 2006-08-12 11:53:23 # Node ID 18cf5349a361edef4f6843f34ff31b2ae93239f3 # Parent a3c73c9679d258cbe9d81092f5eaa8994c97d248 Fix some bugs introduced during the manifest refactoring diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -163,11 +163,12 @@ def archive(repo, dest, node, kind, deco change = repo.changelog.read(node) mn = change[0] archiver = archivers[kind](dest, prefix, mtime or change[2][0]) - mf = repo.manifest.read(mn).items() - mf.sort() + m = repo.manifest.read(mn) + items = m.items() + items.sort() write('.hg_archival.txt', 0644, 'repo: %s\nnode: %s\n' % (hex(repo.changelog.node(0)), hex(node))) - for filename, filenode in mf: - write(filename, mf.execf(filename) and 0755 or 0644, + for filename, filenode in items: + write(filename, m.execf(filename) and 0755 or 0644, repo.file(filename).read(filenode)) archiver.done() diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -398,7 +398,7 @@ class hgweb(object): parent=self.siblings(fl.parents(n), fl.rev, file=f), child=self.siblings(fl.children(n), fl.rev, file=f), rename=self.renamelink(fl, n), - permissions=self.repo.manifest.read(mfn).execf[f]) + permissions=self.repo.manifest.read(mfn).execf(f)) def fileannotate(self, f, node): bcache = {} @@ -452,7 +452,7 @@ class hgweb(object): rename=self.renamelink(fl, n), parent=self.siblings(fl.parents(n), fl.rev, file=f), child=self.siblings(fl.children(n), fl.rev, file=f), - permissions=self.repo.manifest.read(mfn).execf[f]) + permissions=self.repo.manifest.read(mfn).execf(f)) def manifest(self, mnode, path): man = self.repo.manifest @@ -495,7 +495,7 @@ class hgweb(object): "filenode": hex(fnode), "parity": self.stripes(parity), "basename": f, - "permissions": mf.execf[full]} + "permissions": mf.execf(full)} parity += 1 def dirlist(**map): diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -502,7 +502,6 @@ class localrepository(repo.repository): except IOError: try: del m1[f] - del m1[f] if update_dirstate: self.dirstate.forget([f]) except: diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -11,7 +11,9 @@ from demandload import * demandload(globals(), "array bisect struct") class manifestdict(dict): - def __init__(self, mapping={}, flags={}): + def __init__(self, mapping=None, flags=None): + if mapping is None: mapping = {} + if flags is None: flags = {} dict.__init__(self, mapping) self._flags = flags def flags(self, f): @@ -27,8 +29,9 @@ class manifestdict(dict): fl = entry[40:-1] if fl: self._flags[f] = fl def set(self, f, execf=False, linkf=False): - if execf: self._flags[f] = "x" - if linkf: self._flags[f] = "x" + if linkf: self._flags[f] = "l" + elif execf: self._flags[f] = "x" + else: self._flags[f] = "" def copy(self): return manifestdict(dict.copy(self), dict.copy(self._flags))