Skip to content
Snippets Groups Projects
Commit 8af909893188 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

context: clarify the various mode in the _copies property cache

The previous code was compact but a bit dense. The new proposed code deal with
each mode separately, there are some duplicated lines, but the meaning of each
mode stand out.

One of the benefit it to make it simpler to add further mode in the future.

Differential Revision: https://phab.mercurial-scm.org/D6933
parent 15badd621825
No related branches found
No related tags found
No related merge requests found
...@@ -490,14 +490,22 @@ ...@@ -490,14 +490,22 @@
# In compatibility mode, we return copy data from the changeset if # In compatibility mode, we return copy data from the changeset if
# it was recorded there, and otherwise we fall back to getting it from # it was recorded there, and otherwise we fall back to getting it from
# the filelogs (below). # the filelogs (below).
if (source == 'changeset-only' or if source == 'changeset-only':
(source == 'compatibility' and p1copies is not None)): if p1copies is None:
return p1copies or {}, p2copies or {} p1copies = {}
if p2copies is None:
# Otherwise (config said to read only from filelog, or we are in p2copies = {}
# compatiblity mode and there is not data in the changeset), we get elif source == 'compatibility':
# the copy metadata from the filelogs. if p1copies is None:
return super(changectx, self)._copies # we are in compatiblity mode and there is not data in the
# changeset), we get the copy metadata from the filelogs.
p1copies, p2copies = super(changectx, self)._copies
else:
# config said to read only from filelog, we get the copy metadata
# from the filelogs.
p1copies, p2copies = super(changectx, self)._copies
return p1copies, p2copies
def description(self): def description(self):
return self._changeset.description return self._changeset.description
def branch(self): def branch(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment