Show More
@@ -470,6 +470,9 b" coreconfigitem('experimental', 'bundleco" | |||||
470 | coreconfigitem('experimental', 'changegroup3', |
|
470 | coreconfigitem('experimental', 'changegroup3', | |
471 | default=False, |
|
471 | default=False, | |
472 | ) |
|
472 | ) | |
|
473 | coreconfigitem('experimental', 'cleanup-as-archived', | |||
|
474 | default=False, | |||
|
475 | ) | |||
473 | coreconfigitem('experimental', 'clientcompressionengines', |
|
476 | coreconfigitem('experimental', 'clientcompressionengines', | |
474 | default=list, |
|
477 | default=list, | |
475 | ) |
|
478 | ) |
@@ -1016,6 +1016,7 b' def cleanupnodes(repo, replacements, ope' | |||||
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 | |
@@ -1033,6 +1034,17 b' def cleanupnodes(repo, replacements, ope' | |||||
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) |
@@ -75,3 +75,69 b' Test that bundle can unarchive a changes' | |||||
75 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
75 | date: Thu Jan 01 00:00:00 1970 +0000 | |
76 | summary: root |
|
76 | summary: root | |
77 |
|
77 | |||
|
78 | ||||
|
79 | Test that history rewriting command can use the archived phase when allowed to | |||
|
80 | ------------------------------------------------------------------------------ | |||
|
81 | ||||
|
82 | $ hg up 'desc(unbundletesting)' | |||
|
83 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
84 | $ echo bar >> a | |||
|
85 | $ hg commit --amend --config experimental.cleanup-as-archived=yes | |||
|
86 | $ hg log -G | |||
|
87 | @ changeset: 2:d1e73e428f29 | |||
|
88 | | tag: tip | |||
|
89 | | parent: 0:c1863a3840c6 | |||
|
90 | | user: test | |||
|
91 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
92 | | summary: unbundletesting | |||
|
93 | | | |||
|
94 | o changeset: 0:c1863a3840c6 | |||
|
95 | user: test | |||
|
96 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
97 | summary: root | |||
|
98 | ||||
|
99 | $ hg log -G --hidden | |||
|
100 | @ changeset: 2:d1e73e428f29 | |||
|
101 | | tag: tip | |||
|
102 | | parent: 0:c1863a3840c6 | |||
|
103 | | user: test | |||
|
104 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
105 | | summary: unbundletesting | |||
|
106 | | | |||
|
107 | | o changeset: 1:883aadbbf309 | |||
|
108 | |/ user: test | |||
|
109 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
110 | | summary: unbundletesting | |||
|
111 | | | |||
|
112 | o changeset: 0:c1863a3840c6 | |||
|
113 | user: test | |||
|
114 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
115 | summary: root | |||
|
116 | ||||
|
117 | $ ls -1 .hg/strip-backup/ | |||
|
118 | 883aadbbf309-efc55adc-amend.hg | |||
|
119 | 883aadbbf309-efc55adc-backup.hg | |||
|
120 | $ hg unbundle .hg/strip-backup/883aadbbf309*amend.hg | |||
|
121 | adding changesets | |||
|
122 | adding manifests | |||
|
123 | adding file changes | |||
|
124 | added 0 changesets with 0 changes to 1 files | |||
|
125 | (run 'hg update' to get a working copy) | |||
|
126 | $ hg log -G | |||
|
127 | @ changeset: 2:d1e73e428f29 | |||
|
128 | | tag: tip | |||
|
129 | | parent: 0:c1863a3840c6 | |||
|
130 | | user: test | |||
|
131 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
132 | | summary: unbundletesting | |||
|
133 | | | |||
|
134 | | o changeset: 1:883aadbbf309 | |||
|
135 | |/ user: test | |||
|
136 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
137 | | summary: unbundletesting | |||
|
138 | | | |||
|
139 | o changeset: 0:c1863a3840c6 | |||
|
140 | user: test | |||
|
141 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
142 | summary: root | |||
|
143 |
General Comments 0
You need to be logged in to leave comments.
Login now