Comments
Patch
@@ -75,6 +75,16 @@
and self.copied_from_p2 == other.copied_from_p2
)
+ @property
+ def has_copies_info(self):
+ return bool(
+ self.removed
+ or self.merged
+ or self.salvaged
+ or self.copied_from_p1
+ or self.copied_from_p2
+ )
+
@util.propertycache
def added(self):
"""files actively added in the changeset
@@ -244,8 +254,7 @@
def _process_root(ctx):
- """compute the appropriate changed files for a changeset with no parents
- """
+ """compute the appropriate changed files for a changeset with no parents"""
# Simple, there was nothing before it, so everything is added.
md = ChangingFiles()
manifest = ctx.manifest()
@@ -255,8 +264,7 @@
def _process_linear(parent_ctx, children_ctx, parent=1):
- """compute the appropriate changed files for a changeset with a single parent
- """
+ """compute the appropriate changed files for a changeset with a single parent"""
md = ChangingFiles()
parent_manifest = parent_ctx.manifest()
children_manifest = children_ctx.manifest()
@@ -505,8 +513,7 @@
def computechangesetfilesadded(ctx):
- """return the list of files added in a changeset
- """
+ """return the list of files added in a changeset"""
added = []
for f in ctx.files():
if not any(f in p for p in ctx.parents()):
@@ -570,8 +577,7 @@
def computechangesetfilesremoved(ctx):
- """return the list of files removed in a changeset
- """
+ """return the list of files removed in a changeset"""
removed = []
for f in ctx.files():
if f not in ctx:
@@ -583,8 +589,7 @@
def computechangesetfilesmerged(ctx):
- """return the list of files merged in a changeset
- """
+ """return the list of files merged in a changeset"""
merged = []
if len(ctx.parents()) < 2:
return merged
@@ -91,8 +91,8 @@
class appender(object):
- '''the changelog index must be updated last on disk, so we use this class
- to delay writes to it'''
+ """the changelog index must be updated last on disk, so we use this class
+ to delay writes to it"""
def __init__(self, vfs, name, mode, buf):
self.data = buf
@@ -583,13 +583,7 @@
flags = 0
sidedata = None
if self._copiesstorage == b'changeset-sidedata':
- if (
- files.removed
- or files.merged
- or files.salvaged
- or files.copied_from_p1
- or files.copied_from_p2
- ):
+ if files.has_copies_info:
flags |= flagutil.REVIDX_HASCOPIESINFO
sidedata = metadata.encode_files_sidedata(files)