Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 42142:5382d8f8530b
changelog: parse copy metadata if available in extras
This lets read back the copy metadata we just started writing. There
are still many places left to teach about getting the copy information
from the changeset, but we have enough ({file_copies}, specifically)
that we can add it now and have some test coverage of it.
Differential Revision: https://phab.mercurial-scm.org/D6186
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 27 Dec 2017 22:05:20 -0800 |
parents | 976f069e0ad6 |
children | 14589f1989e9 |
comparison
equal
deleted
inserted
replaced
42141:0e41f40b01cc | 42142:5382d8f8530b |
---|---|
439 return self._changeset.date | 439 return self._changeset.date |
440 def files(self): | 440 def files(self): |
441 return self._changeset.files | 441 return self._changeset.files |
442 @propertycache | 442 @propertycache |
443 def _copies(self): | 443 def _copies(self): |
444 source = self._repo.ui.config('experimental', 'copies.read-from') | |
445 p1copies = self._changeset.p1copies | |
446 p2copies = self._changeset.p2copies | |
447 # If config says to get copy metadata only from changeset, then return | |
448 # that, defaulting to {} if there was no copy metadata. | |
449 # In compatibility mode, we return copy data from the changeset if | |
450 # it was recorded there, and otherwise we fall back to getting it from | |
451 # the filelogs (below). | |
452 if (source == 'changeset-only' or | |
453 (source == 'compatibility' and p1copies is not None)): | |
454 return p1copies or {}, p2copies or {} | |
455 | |
456 # Otherwise (config said to read only from filelog, or we are in | |
457 # compatiblity mode and there is not data in the changeset), we get | |
458 # the copy metadata from the filelogs. | |
444 p1copies = {} | 459 p1copies = {} |
445 p2copies = {} | 460 p2copies = {} |
446 p1 = self.p1() | 461 p1 = self.p1() |
447 p2 = self.p2() | 462 p2 = self.p2() |
448 narrowmatch = self._repo.narrowmatch() | 463 narrowmatch = self._repo.narrowmatch() |