Commit ef340637 authored by Eric S. Raymond's avatar Eric S. Raymond

Fix the cut operation...

...andcdeclare some tests correct that only have commit numbers deranged.
parent 9755426e
......@@ -1673,7 +1673,7 @@ class FileOp(object):
"Represent a primitive operation on a file."
__slots__ = ("repo", "op", "committish", "source", "target",
"mode", "path", "ref", "inline", "deletehook",
"sourcedelete", "targetdelete")
"sourcedelete", "targetdelete", "color")
__hash__ = None
modify_re = re.compile(r"(M) ([0-9]+) (\S+) (.*)")
sortkey_sentinel = chr(ord(b"/") + 1)
......@@ -1688,6 +1688,7 @@ def __init__(self, repo):
self.ref = None
self.inline = None
self.deletehook = None # Hook used during deletion operations
self.color = None
def setOp(self, op):
self.op = op
def index(self):
......@@ -6691,7 +6692,11 @@ def cut(self, early, late):
# Front events go with early segment, they'll be copied to late one.
for event in self.repo.front_events():
event.color = "early"
assert all(hasattr(x, b"color") or hasattr(x, b"colors") or isinstance(x, Reset) for x in self.repo)
# FileOps go with their commits
for event in self.repo.commits():
for op in event.operations():
op.color = event.color
assert all(hasattr(x, b"color") or hasattr(x, b"colors") or isinstance(x, Reset or isinstance(x, FileOp)) for x in self.repo)
# Resets are tricky. One may have both colors.
# Blobs can have both colors too, through references in
# commits on both sides of the cut, but we took care
......
read <testrepo.fi
<2010-11-06T10:49:58Z> list
14 2010-11-06T10:49:58Z :13 Create the third doomed file.
21 2010-11-06T10:49:58Z :13 Create the third doomed file.
<2010-11-06T10:49:58Z> assign fubar
<fubar> list
14 2010-11-06T10:49:58Z :13 Create the third doomed file.
21 2010-11-06T10:49:58Z :13 Create the third doomed file.
<quozzle> resolve Unassigned name
reposurgeon: couldn't match a name at <quozzle>
1 assign fubar
......@@ -13,7 +13,7 @@ Check that sequence mutation does not invalidate assignments
<2010-11-05T22:47:47Z> delete
reposurgeon: warning: commit :4 to be deleted has non-delete fileops.
<fubar> list
13 2010-11-06T10:49:58Z :13 Create the third doomed file.
19 2010-11-06T10:49:58Z :13 Create the third doomed file.
print Check that deleting the assigned commit does
Check that deleting the assigned commit does
<2010-11-06T10:49:58Z> delete
......@@ -25,7 +25,7 @@ print Test unassign
Test unassign
:32 assign glarp
<glarp> list
30 2010-11-08T23:02:38Z :32 Recreating bar.
48 2010-11-08T23:02:38Z :32 Recreating bar.
unassign glarp
<glarp> list
reposurgeon: couldn't match a name at <glarp>
read <deleteall.fi
:13 manifest
Event 16 ================================================================
Event 23 ================================================================
commit refs/heads/samplebranch2
mark :13
README-branch2 -> :9
[/^README/a] resolve
[1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 15, 16]
[1, 2, 4, 5, 7, 9, 11, 12, 14, 15, 17, 21, 23]
[/^README$/a] resolve
[1, 2, 3, 4, 5, 7, 8, 9, 11, 12, 15]
[1, 2, 4, 5, 7, 9, 11, 12, 15, 17, 21]
......@@ -31,7 +31,7 @@ committer Ralf Schlatterbeck <rsc@runtux.com> 0 +0000
data 14
First commit.
M 100644 :1 README
M 100664 :2 .hgignore
M 100644 :2 .hgignore
blob
mark :4
......
......@@ -2,9 +2,9 @@ Initially no sourcetype is set, so =N should be empty
[]
Expect 2 CVS results
2 2012-12-02T05:37:55Z :2 An example dotted numeric 1.1 in a sentence.
4 2012-12-02T05:39:18Z :4 End-of-sentence CVS-style 1.1.
5 2012-12-02T05:39:18Z :4 End-of-sentence CVS-style 1.1.
Expect 4 SVN results
6 2012-12-02T05:39:21Z :6 Subversion-style r123 in midsentence.
8 2012-12-02T05:39:23Z :8 End-of-sentence subversion-style r123.
10 2012-12-02T05:39:25Z :10 Bare 123 in midsentence.
12 2012-12-02T05:39:27Z :12 End-of-sentence bare numeric 123.
8 2012-12-02T05:39:21Z :6 Subversion-style r123 in midsentence.
11 2012-12-02T05:39:23Z :8 End-of-sentence subversion-style r123.
14 2012-12-02T05:39:25Z :10 Bare 123 in midsentence.
17 2012-12-02T05:39:27Z :12 End-of-sentence bare numeric 123.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment