mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
copies: enable dagcopytrace for duplicatecopies() to fix empty commit issue
Summary: The original copytrace was too slow, so it was disabled by default. This diff enables `dagcopytrace` (new fast copytrace) for duplicatecopies() to fix the empty commit issue. Reviewed By: sggutier Differential Revision: D46975341 fbshipit-source-id: 11219daee9e400a5ff1d8eda26fe17fbca5d5f12
This commit is contained in:
parent
0cba5730b5
commit
f6a33aeec0
@ -927,16 +927,21 @@ def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None):
|
||||
skiprev will not be duplicated, even if they appear in the set of
|
||||
copies between fromrev and rev.
|
||||
"""
|
||||
exclude = {}
|
||||
if skiprev is not None and repo.ui.config("experimental", "copytrace") != "off":
|
||||
# copytrace='off' skips this line, but not the entire function because
|
||||
# the line below is O(size of the repo) during a rebase, while the rest
|
||||
# of the function is much faster (and is required for carrying copy
|
||||
# metadata across the rebase anyway).
|
||||
exclude = pathcopies(repo[fromrev], repo[skiprev])
|
||||
dagcopytrace = _get_dagcopytrace(repo, wctx, skiprev)
|
||||
for dst, src in pycompat.iteritems(pathcopies(repo[fromrev], repo[rev])):
|
||||
# copies.pathcopies returns backward renames, so dst might not
|
||||
# actually be in the dirstate
|
||||
if dst in exclude:
|
||||
if dagcopytrace and dagcopytrace.trace_rename(
|
||||
repo[skiprev].node(), repo[fromrev].node(), dst
|
||||
):
|
||||
continue
|
||||
wctx[dst].markcopied(src)
|
||||
|
||||
|
||||
def _get_dagcopytrace(repo, wctx, skiprev):
|
||||
"""this is for fixing empty commit issue in non-IMM case"""
|
||||
if (
|
||||
skiprev is None
|
||||
or wctx.isinmemory()
|
||||
or not repo.ui.configbool("copytrace", "skipduplicatecopies")
|
||||
):
|
||||
return None
|
||||
return repo._dagcopytrace
|
||||
|
@ -42,21 +42,12 @@
|
||||
rebasing 811ec875201f "b" (b)
|
||||
note: rebase of 811ec875201f created no changes to commit
|
||||
|
||||
# Without IMM, this behavior is semi-broken: the commit is not rebased out and the
|
||||
# created commit is empty. (D8676355)
|
||||
# Without IMM, confirm empty commit issue (D8676355) is fixed
|
||||
|
||||
$ cd ../without-imm
|
||||
|
||||
$ setconfig 'rebase.experimental.inmemory=0'
|
||||
$ setconfig 'copytrace.skipduplicatecopies=True'
|
||||
$ hg rebase -r b -d a
|
||||
rebasing 811ec875201f "b" (b)
|
||||
warning: can't find ancestor for 'file_new' copied from 'file'!
|
||||
|
||||
$ hg export tip
|
||||
# HG changeset patch
|
||||
# User test
|
||||
# Date 0 0
|
||||
# Thu Jan 01 00:00:00 1970 +0000
|
||||
# Node ID 0fe513c05d7fe2819c3ceccb072e74940604af36
|
||||
# Parent 24483d5afe6cb1a13b3642b4d8622e91f4d1bec1
|
||||
b
|
||||
note: rebase of 811ec875201f created no changes to commit
|
||||
|
Loading…
Reference in New Issue
Block a user