Attachment 'revlog_metadata_write.diff'
Download 1 diff -r 892806b3fc0f mercurial/filelog.py
2 --- a/mercurial/filelog.py Sun Aug 10 22:55:00 2008 -0500
3 +++ b/mercurial/filelog.py Fri Aug 22 17:10:09 2008 +0200
4 @@ -46,6 +46,13 @@
5 m[k] = v
6 return m
7
8 + def _hasmeta(self, node):
9 + t = self.revision(node)
10 + if not t.startswith('\1\n'):
11 + return False
12 + else:
13 + return True
14 +
15 def add(self, text, meta, transaction, link, p1=None, p2=None):
16 if meta or text.startswith('\1\n'):
17 mt = ""
18 @@ -65,9 +72,9 @@
19 def size(self, rev):
20 """return the size of a given revision"""
21
22 - # for revisions with renames, we have to go the slow way
23 + # for revisions with metadata, we have to go the slow way
24 node = self.node(rev)
25 - if self.renamed(node):
26 + if self._hasmeta(node):
27 return len(self.read(node))
28
29 return revlog.size(self, rev)
30 @@ -75,8 +82,8 @@
31 def cmp(self, node, text):
32 """compare text with a given file revision"""
33
34 - # for renames, we have to go the slow way
35 - if self.renamed(node):
36 + # for metadata, we have to go the slow way
37 + if self._hasmeta(node):
38 t2 = self.read(node)
39 return t2 != text
40
41 diff -r 892806b3fc0f mercurial/localrepo.py
42 --- a/mercurial/localrepo.py Sun Aug 10 22:55:00 2008 -0500
43 +++ b/mercurial/localrepo.py Fri Aug 22 17:10:09 2008 +0200
44 @@ -680,7 +680,7 @@
45 self._wlockref = weakref.ref(l)
46 return l
47
48 - def filecommit(self, fn, manifest1, manifest2, linkrev, tr, changelist):
49 + def filecommit(self, fn, manifest1, manifest2, linkrev, tr, changelist, metadata=None):
50 """
51 commit an individual file as part of a larger transaction
52 """
53 @@ -690,7 +690,7 @@
54 fp1 = manifest1.get(fn, nullid)
55 fp2 = manifest2.get(fn, nullid)
56
57 - meta = {}
58 + meta = metadata or {}
59 cf = self.dirstate.copied(fn)
60 if cf and cf != fn:
61 # Mark the new revision of this file as a copy of another
62 @@ -766,7 +766,7 @@
63
64 def commit(self, files=None, text="", user=None, date=None,
65 match=util.always, force=False, force_editor=False,
66 - p1=None, p2=None, extra={}, empty_ok=False):
67 + p1=None, p2=None, extra={}, files_meta={}, empty_ok=False):
68 wlock = lock = tr = None
69 valid = 0 # don't save the dirstate if this isn't set
70 if files:
71 @@ -849,7 +849,8 @@
72 for f in commit:
73 self.ui.note(f + "\n")
74 try:
75 - new[f] = self.filecommit(f, m1, m2, linkrev, trp, changed)
76 + metadata = files_meta.get(f)
77 + new[f] = self.filecommit(f, m1, m2, linkrev, trp, changed, metadata)
78 new_exec = is_exec(f)
79 new_link = is_link(f)
80 if ((not changed or changed[-1] != f) and
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.