Show More
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | |
|
8 | 8 | import base64, errno, subprocess, os, datetime, re |
|
9 | 9 | import cPickle as pickle |
|
10 | from mercurial import util | |
|
10 | from mercurial import phases, util | |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | 12 | |
|
13 | 13 | propertycache = util.propertycache |
@@ -44,7 +44,7 b" SKIPREV = 'SKIP'" | |||
|
44 | 44 | |
|
45 | 45 | class commit(object): |
|
46 | 46 | def __init__(self, author, date, desc, parents, branch=None, rev=None, |
|
47 | extra={}, sortkey=None, saverev=True): | |
|
47 | extra={}, sortkey=None, saverev=True, phase=phases.draft): | |
|
48 | 48 | self.author = author or 'unknown' |
|
49 | 49 | self.date = date or '0 0' |
|
50 | 50 | self.desc = desc |
@@ -54,6 +54,7 b' class commit(object):' | |||
|
54 | 54 | self.extra = extra |
|
55 | 55 | self.sortkey = sortkey |
|
56 | 56 | self.saverev = saverev |
|
57 | self.phase = phase | |
|
57 | 58 | |
|
58 | 59 | class converter_source(object): |
|
59 | 60 | """Conversion source interface""" |
@@ -22,6 +22,7 b' import os, time, cStringIO' | |||
|
22 | 22 | from mercurial.i18n import _ |
|
23 | 23 | from mercurial.node import bin, hex, nullid |
|
24 | 24 | from mercurial import hg, util, context, bookmarks, error, scmutil, exchange |
|
25 | from mercurial import phases | |
|
25 | 26 | |
|
26 | 27 | from common import NoRepo, commit, converter_source, converter_sink, mapfile |
|
27 | 28 | |
@@ -258,7 +259,29 b' class mercurial_sink(converter_sink):' | |||
|
258 | 259 | fileset.update(self.repo[p2]) |
|
259 | 260 | ctx = context.memctx(self.repo, (p1, p2), text, fileset, |
|
260 | 261 | getfilectx, commit.author, commit.date, extra) |
|
261 | self.repo.commitctx(ctx) | |
|
262 | ||
|
263 | # We won't know if the conversion changes the node until after the | |
|
264 | # commit, so copy the source's phase for now. | |
|
265 | self.repo.ui.setconfig('phases', 'new-commit', | |
|
266 | phases.phasenames[commit.phase], 'convert') | |
|
267 | ||
|
268 | tr = self.repo.transaction("convert") | |
|
269 | ||
|
270 | try: | |
|
271 | node = hex(self.repo.commitctx(ctx)) | |
|
272 | ||
|
273 | # If the node value has changed, but the phase is lower than | |
|
274 | # draft, set it back to draft since it hasn't been exposed | |
|
275 | # anywhere. | |
|
276 | if commit.rev != node: | |
|
277 | ctx = self.repo[node] | |
|
278 | if ctx.phase() < phases.draft: | |
|
279 | phases.retractboundary(self.repo, tr, phases.draft, | |
|
280 | [ctx.node()]) | |
|
281 | tr.close() | |
|
282 | finally: | |
|
283 | tr.release() | |
|
284 | ||
|
262 | 285 | text = "(octopus merge fixup)\n" |
|
263 | 286 | p2 = hex(self.repo.changelog.tip()) |
|
264 | 287 | |
@@ -479,7 +502,8 b' class mercurial_source(converter_source)' | |||
|
479 | 502 | date=util.datestr(ctx.date(), '%Y-%m-%d %H:%M:%S %1%2'), |
|
480 | 503 | desc=ctx.description(), rev=crev, parents=parents, |
|
481 | 504 | branch=ctx.branch(), extra=ctx.extra(), |
|
482 |
sortkey=ctx.rev(), saverev=self.saverev |
|
|
505 | sortkey=ctx.rev(), saverev=self.saverev, | |
|
506 | phase=ctx.phase()) | |
|
483 | 507 | |
|
484 | 508 | def gettags(self): |
|
485 | 509 | # This will get written to .hgtags, filter non global tags out. |
@@ -121,7 +121,7 b' convert fresh repo with --filemap' | |||
|
121 | 121 | 1 ci0 |
|
122 | 122 | 0 import |
|
123 | 123 | filtering out empty revision |
|
124 |
repository tip rolled back to revision 1 (undo co |
|
|
124 | repository tip rolled back to revision 1 (undo convert) | |
|
125 | 125 | updating tags |
|
126 | 126 | $ hgcat b/c |
|
127 | 127 | c |
@@ -477,7 +477,7 b' filemap rename undoing revision rename' | |||
|
477 | 477 | 2 add |
|
478 | 478 | 1 rename |
|
479 | 479 | filtering out empty revision |
|
480 |
repository tip rolled back to revision 0 (undo co |
|
|
480 | repository tip rolled back to revision 0 (undo convert) | |
|
481 | 481 | 0 modify |
|
482 | 482 | $ glog -R renameundo2 |
|
483 | 483 | o 1 "modify" files: a c |
@@ -41,6 +41,7 b'' | |||
|
41 | 41 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
42 | 42 | summary: add foo and bar |
|
43 | 43 | |
|
44 | $ hg phase --public -r tip | |
|
44 | 45 | $ cd .. |
|
45 | 46 | $ hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' |
|
46 | 47 | initializing destination new repository |
@@ -52,6 +53,16 b'' | |||
|
52 | 53 | 1 add foo/file |
|
53 | 54 | 0 Added tag some-tag for changeset ad681a868e44 |
|
54 | 55 | $ cd new |
|
56 | $ hg log -G --template '{rev} {node|short} ({phase}) "{desc}"\n' | |
|
57 | o 3 593cbf6fb2b4 (public) "Added tag some-tag for changeset ad681a868e44" | |
|
58 | | | |
|
59 | o 2 ad681a868e44 (public) "add foo/file" | |
|
60 | | | |
|
61 | o 1 cbba8ecc03b7 (public) "remove foo" | |
|
62 | | | |
|
63 | o 0 327daa9251fa (public) "add foo and bar" | |
|
64 | ||
|
65 | ||
|
55 | 66 | $ hg out ../orig |
|
56 | 67 | comparing with ../orig |
|
57 | 68 | searching for changes |
@@ -132,7 +143,7 b' Helper' | |||
|
132 | 143 | |
|
133 | 144 | $ glog() |
|
134 | 145 | > { |
|
135 | > hg log -G --template '{rev} {node|short} "{desc}" files: {files}\n' $* | |
|
146 | > hg log -G --template '{rev} {node|short} ({phase}) "{desc}" files: {files}\n' $* | |
|
136 | 147 | > } |
|
137 | 148 | |
|
138 | 149 | Create a tricky source repo |
@@ -171,20 +182,21 b' Create a tricky source repo' | |||
|
171 | 182 | dir/c |
|
172 | 183 | dir/d |
|
173 | 184 | e |
|
185 | $ hg phase --public -r tip | |
|
174 | 186 | $ glog |
|
175 | @ 6 0613c8e59a3d "6: change a" files: a | |
|
187 | @ 6 0613c8e59a3d (public) "6: change a" files: a | |
|
176 | 188 | | |
|
177 | o 5 717e9b37cdb7 "5: merge 2 and 3, copy b to dir/d" files: dir/d e | |
|
189 | o 5 717e9b37cdb7 (public) "5: merge 2 and 3, copy b to dir/d" files: dir/d e | |
|
178 | 190 | |\ |
|
179 | | o 4 86a55cb968d5 "4: change a" files: a | |
|
191 | | o 4 86a55cb968d5 (public) "4: change a" files: a | |
|
180 | 192 | | | |
|
181 | o | 3 0e6e235919dd "3: copy a to e, change b" files: b e | |
|
193 | o | 3 0e6e235919dd (public) "3: copy a to e, change b" files: b e | |
|
182 | 194 | | | |
|
183 | o | 2 0394b0d5e4f7 "2: add dir/c" files: dir/c | |
|
195 | o | 2 0394b0d5e4f7 (public) "2: add dir/c" files: dir/c | |
|
184 | 196 | |/ |
|
185 | o 1 333546584845 "1: add a and dir/b" files: a dir/b | |
|
197 | o 1 333546584845 (public) "1: add a and dir/b" files: a dir/b | |
|
186 | 198 | | |
|
187 | o 0 d1a24e2ebd23 "0: add 0" files: 0 | |
|
199 | o 0 d1a24e2ebd23 (public) "0: add 0" files: 0 | |
|
188 | 200 | |
|
189 | 201 | $ cd .. |
|
190 | 202 | |
@@ -209,15 +221,15 b' Convert excluding rev 0 and dir/ (and th' | |||
|
209 | 221 | Verify that conversion skipped rev 2: |
|
210 | 222 | |
|
211 | 223 | $ glog -R dest |
|
212 | o 4 78814e84a217 "6: change a" files: a | |
|
224 | o 4 78814e84a217 (draft) "6: change a" files: a | |
|
213 | 225 | | |
|
214 | o 3 f7cff662c5e5 "5: merge 2 and 3, copy b to dir/d" files: e | |
|
226 | o 3 f7cff662c5e5 (draft) "5: merge 2 and 3, copy b to dir/d" files: e | |
|
215 | 227 | |\ |
|
216 | | o 2 ab40a95b0072 "4: change a" files: a | |
|
228 | | o 2 ab40a95b0072 (draft) "4: change a" files: a | |
|
217 | 229 | | | |
|
218 | o | 1 bd51f17597bf "3: copy a to e, change b" files: b e | |
|
230 | o | 1 bd51f17597bf (draft) "3: copy a to e, change b" files: b e | |
|
219 | 231 | |/ |
|
220 | o 0 a4a1dae0fe35 "1: add a and dir/b" files: 0 a | |
|
232 | o 0 a4a1dae0fe35 (draft) "1: add a and dir/b" files: 0 a | |
|
221 | 233 | |
|
222 | 234 | |
|
223 | 235 | Verify mapping correct in both directions: |
@@ -347,17 +359,17 b' More source changes' | |||
|
347 | 359 | e |
|
348 | 360 | |
|
349 | 361 | $ glog -r 6: |
|
350 | @ 11 0c8927d1f7f4 "11: source change" files: a | |
|
362 | @ 11 0c8927d1f7f4 (draft) "11: source change" files: a | |
|
351 | 363 | | |
|
352 | o 10 9ccb7ee8d261 "10: source merge" files: a | |
|
364 | o 10 9ccb7ee8d261 (draft) "10: source merge" files: a | |
|
353 | 365 | |\ |
|
354 | | o 9 f131b1518dba "9: source second branch" files: a | |
|
366 | | o 9 f131b1518dba (draft) "9: source second branch" files: a | |
|
355 | 367 | | | |
|
356 | o | 8 669cf0e74b50 "8: source first branch" files: a | |
|
368 | o | 8 669cf0e74b50 (draft) "8: source first branch" files: a | |
|
357 | 369 | | | |
|
358 | | o 7 e6d364a69ff1 "change in dest" files: dest | |
|
370 | | o 7 e6d364a69ff1 (draft) "change in dest" files: dest | |
|
359 | 371 | |/ |
|
360 | o 6 0613c8e59a3d "6: change a" files: a | |
|
372 | o 6 0613c8e59a3d (public) "6: change a" files: a | |
|
361 | 373 | | |
|
362 | 374 | $ cd .. |
|
363 | 375 | |
@@ -371,25 +383,25 b' More source changes' | |||
|
371 | 383 | 0 11: source change |
|
372 | 384 | |
|
373 | 385 | $ glog -R dest |
|
374 | o 9 8432d597b263 "11: source change" files: a | |
|
386 | o 9 8432d597b263 (draft) "11: source change" files: a | |
|
375 | 387 | | |
|
376 | o 8 632ffacdcd6f "10: source merge" files: a | |
|
388 | o 8 632ffacdcd6f (draft) "10: source merge" files: a | |
|
377 | 389 | |\ |
|
378 | | o 7 049cfee90ee6 "9: source second branch" files: a | |
|
390 | | o 7 049cfee90ee6 (draft) "9: source second branch" files: a | |
|
379 | 391 | | | |
|
380 | o | 6 9b6845e036e5 "8: source first branch" files: a | |
|
392 | o | 6 9b6845e036e5 (draft) "8: source first branch" files: a | |
|
381 | 393 | | | |
|
382 | | @ 5 a2e0e3cc6d1d "change in dest" files: dest | |
|
394 | | @ 5 a2e0e3cc6d1d (draft) "change in dest" files: dest | |
|
383 | 395 | |/ |
|
384 | o 4 78814e84a217 "6: change a" files: a | |
|
396 | o 4 78814e84a217 (draft) "6: change a" files: a | |
|
385 | 397 | | |
|
386 | o 3 f7cff662c5e5 "5: merge 2 and 3, copy b to dir/d" files: e | |
|
398 | o 3 f7cff662c5e5 (draft) "5: merge 2 and 3, copy b to dir/d" files: e | |
|
387 | 399 | |\ |
|
388 | | o 2 ab40a95b0072 "4: change a" files: a | |
|
400 | | o 2 ab40a95b0072 (draft) "4: change a" files: a | |
|
389 | 401 | | | |
|
390 | o | 1 bd51f17597bf "3: copy a to e, change b" files: b e | |
|
402 | o | 1 bd51f17597bf (draft) "3: copy a to e, change b" files: b e | |
|
391 | 403 | |/ |
|
392 | o 0 a4a1dae0fe35 "1: add a and dir/b" files: 0 a | |
|
404 | o 0 a4a1dae0fe35 (draft) "1: add a and dir/b" files: 0 a | |
|
393 | 405 | |
|
394 | 406 | $ cd .. |
|
395 | 407 | |
@@ -520,7 +532,7 b' An additional round, demonstrating that ' | |||
|
520 | 532 | Conversion after rollback |
|
521 | 533 | |
|
522 | 534 | $ hg -R a rollback -f |
|
523 |
repository tip rolled back to revision 2 (undo co |
|
|
535 | repository tip rolled back to revision 2 (undo convert) | |
|
524 | 536 | |
|
525 | 537 | $ hg convert --filemap filemap-b 0 a --config convert.hg.revs=1:: |
|
526 | 538 | scanning source... |
General Comments 0
You need to be logged in to leave comments.
Login now