mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 14:46:47 +03:00
cmdutil: add copy-filtering support to duplicatecopies
In order to fix issue 4192 we need to be able to skip some copies while doing duplicatecopies.
This commit is contained in:
parent
870dfdf91c
commit
23d3b7a1e7
@ -1913,11 +1913,22 @@ def cat(ui, repo, ctx, matcher, prefix, **opts):
|
||||
|
||||
return err
|
||||
|
||||
def duplicatecopies(repo, rev, fromrev):
|
||||
'''reproduce copies from fromrev to rev in the dirstate'''
|
||||
def duplicatecopies(repo, rev, fromrev, skiprev=None):
|
||||
'''reproduce copies from fromrev to rev in the dirstate
|
||||
|
||||
If skiprev is specified, it's a revision that should be used to
|
||||
filter copy records. Any copies that occur between fromrev and
|
||||
skiprev will not be duplicated, even if they appear in the set of
|
||||
copies between fromrev and rev.
|
||||
'''
|
||||
exclude = {}
|
||||
if skiprev is not None:
|
||||
exclude = copies.pathcopies(repo[fromrev], repo[skiprev])
|
||||
for dst, src in copies.pathcopies(repo[fromrev], repo[rev]).iteritems():
|
||||
# copies.pathcopies returns backward renames, so dst might not
|
||||
# actually be in the dirstate
|
||||
if dst in exclude:
|
||||
continue
|
||||
if repo.dirstate[dst] in "nma":
|
||||
repo.dirstate.copy(src, dst)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user