comparison mercurial/scmutil.py @ 41799:64de5f44eec3

rewriting: add an option for rewrite commands to use the archived phase Using the archived phase for cleanup provide the same effect than stripping, but in a faster, append-only way. We keep the feature experimental for now until it gets a bit more testing.
author Boris Feld <boris.feld@octobus.net>
date Wed, 02 Jan 2019 03:07:52 +0100
parents e9b9ee9af4a9
children 232d4b9d391a
comparison
equal deleted inserted replaced
41798:8c42b4a3d447 41799:64de5f44eec3
1014 for phase, nodes in toretract.items(): 1014 for phase, nodes in toretract.items():
1015 phases.retractboundary(repo, tr, phase, nodes) 1015 phases.retractboundary(repo, tr, phase, nodes)
1016 for phase, nodes in toadvance.items(): 1016 for phase, nodes in toadvance.items():
1017 phases.advanceboundary(repo, tr, phase, nodes) 1017 phases.advanceboundary(repo, tr, phase, nodes)
1018 1018
1019 mayusearchived = repo.ui.config('experimental', 'cleanup-as-archived')
1019 # Obsolete or strip nodes 1020 # Obsolete or strip nodes
1020 if obsolete.isenabled(repo, obsolete.createmarkersopt): 1021 if obsolete.isenabled(repo, obsolete.createmarkersopt):
1021 # If a node is already obsoleted, and we want to obsolete it 1022 # If a node is already obsoleted, and we want to obsolete it
1022 # without a successor, skip that obssolete request since it's 1023 # without a successor, skip that obssolete request since it's
1023 # unnecessary. That's the "if s or not isobs(n)" check below. 1024 # unnecessary. That's the "if s or not isobs(n)" check below.
1031 rel = (tuple(unfi[n] for n in ns), tuple(unfi[m] for m in s)) 1032 rel = (tuple(unfi[n] for n in ns), tuple(unfi[m] for m in s))
1032 rels.append(rel) 1033 rels.append(rel)
1033 if rels: 1034 if rels:
1034 obsolete.createmarkers(repo, rels, operation=operation, 1035 obsolete.createmarkers(repo, rels, operation=operation,
1035 metadata=metadata) 1036 metadata=metadata)
1037 elif phases.supportinternal(repo) and mayusearchived:
1038 # this assume we do not have "unstable" nodes above the cleaned ones
1039 allreplaced = set()
1040 for ns in replacements.keys():
1041 allreplaced.update(ns)
1042 if backup:
1043 from . import repair # avoid import cycle
1044 node = min(allreplaced, key=repo.changelog.rev)
1045 repair.backupbundle(repo, allreplaced, allreplaced, node,
1046 operation)
1047 phases.retractboundary(repo, tr, phases.archived, allreplaced)
1036 else: 1048 else:
1037 from . import repair # avoid import cycle 1049 from . import repair # avoid import cycle
1038 tostrip = list(n for ns in replacements for n in ns) 1050 tostrip = list(n for ns in replacements for n in ns)
1039 if tostrip: 1051 if tostrip:
1040 repair.delayedstrip(repo.ui, repo, tostrip, operation, 1052 repair.delayedstrip(repo.ui, repo, tostrip, operation,