930
930
def check_not_reserved_id(version_id):
931
931
revision.check_not_reserved_id(version_id)
933
def clear_cache(self):
934
"""Clear whatever caches this VersionedFile holds.
936
This is generally called after an operation has been performed, when we
937
don't expect to be using this versioned file again soon.
933
940
def _check_lines_not_unicode(self, lines):
934
941
"""Check that lines being added to a versioned file are not unicode."""
935
942
for line in lines:
1483
1490
for struct in outstanding_struct():
1486
def base_from_plan(self):
1487
"""Construct a BASE file from the plan text."""
1489
for state, line in self.plan:
1490
# XXX: We need to figure out what to do for 'conflicted-a' and
1491
# 'conflicted-b' lines. Here is a rough outline of the
1492
# options. Also, I tested this using the 'weave' failure.
1493
# Where you have a criss-cross merge, where both a & b
1494
# introduce a line in the same place. The merge conflicts, and
1495
# both include both lines, but put themselves first.
1503
# 1) Include them in .BASE, as they are present in one LCA
1504
# (but not in all of them). In my test, that led to all
1505
# LCA's getting merged together into a big text, which
1507
# In testing, this gives BASE of MbabN, and the standard
1508
# 3-way diff then looks like BASE => THIS is deleting the
1509
# first line 'b', and BASE => OTHER is deleting the second
1510
# line 'b'. Which means that diff3 of THIS BASE OTHER gives
1511
# MaN (no conflicts)
1512
# 2) Exclude them in .BASE, because they aren't in all BASEs.
1513
# diff3 then sees 'b' being added by both sides before and
1514
# after 'a'. Which gives MbabN (no conflicts)
1515
if state in ('killed-a', 'killed-b', 'killed-both', 'unchanged',
1516
'conflicted-a', 'conflicted-b'):
1517
# If unchanged, then this line is straight from base. If a or b
1518
# or both killed the line, then it *used* to be in base.
1519
# If 'conflicted-a' or b, then it is new vs one base, but old
1520
# versus another base. Which means it was present in *one* of
1521
# the bases, so we'll include it.
1522
base_lines.append(line)
1524
if state not in ('killed-base', 'irrelevant',
1525
'ghost-a', 'ghost-b',
1527
# killed-base, irrelevant means it doesn't apply
1528
# ghost-a/ghost-b are harder to say for sure, but they
1529
# aren't in the 'inc_c' which means they aren't in the
1530
# shared base of a & b. So we don't include them.
1531
# And obviously if the line is newly inserted, it isn't in
1533
raise AssertionError('Unknown state: %s' % (state,))
1537
1494
class WeaveMerge(PlanWeaveMerge):
1538
1495
"""Weave merge that takes a VersionedFile and two versions as its input."""