Show More
@@ -888,6 +888,34 b' def obsolete(repo, subset, x):' | |||||
888 | getargs(x, 0, 0, _("obsolete takes no arguments")) |
|
888 | getargs(x, 0, 0, _("obsolete takes no arguments")) | |
889 | return [r for r in subset if repo[r].obsolete()] |
|
889 | return [r for r in subset if repo[r].obsolete()] | |
890 |
|
890 | |||
|
891 | def origin(repo, subset, x): | |||
|
892 | """``origin([set])`` | |||
|
893 | Changesets that were specified as a source for the grafts, transplants or | |||
|
894 | rebases that created the given revisions. Omitting the optional set is the | |||
|
895 | same as passing all(). If a changeset created by these operations is itself | |||
|
896 | specified as a source for one of these operations, only the source changeset | |||
|
897 | for the first operation is selected. | |||
|
898 | """ | |||
|
899 | if x is not None: | |||
|
900 | args = set(getset(repo, range(len(repo)), x)) | |||
|
901 | else: | |||
|
902 | args = set(getall(repo, range(len(repo)), x)) | |||
|
903 | ||||
|
904 | def _firstsrc(rev): | |||
|
905 | src = _getrevsource(repo, rev) | |||
|
906 | if src is None: | |||
|
907 | return None | |||
|
908 | ||||
|
909 | while True: | |||
|
910 | prev = _getrevsource(repo, src) | |||
|
911 | ||||
|
912 | if prev is None: | |||
|
913 | return src | |||
|
914 | src = prev | |||
|
915 | ||||
|
916 | o = set([_firstsrc(r) for r in args]) | |||
|
917 | return [r for r in subset if r in o] | |||
|
918 | ||||
891 | def outgoing(repo, subset, x): |
|
919 | def outgoing(repo, subset, x): | |
892 | """``outgoing([path])`` |
|
920 | """``outgoing([path])`` | |
893 | Changesets not found in the specified destination repository, or the |
|
921 | Changesets not found in the specified destination repository, or the | |
@@ -1392,6 +1420,7 b' symbols = {' | |||||
1392 | "min": minrev, |
|
1420 | "min": minrev, | |
1393 | "modifies": modifies, |
|
1421 | "modifies": modifies, | |
1394 | "obsolete": obsolete, |
|
1422 | "obsolete": obsolete, | |
|
1423 | "origin": origin, | |||
1395 | "outgoing": outgoing, |
|
1424 | "outgoing": outgoing, | |
1396 | "p1": p1, |
|
1425 | "p1": p1, | |
1397 | "p2": p2, |
|
1426 | "p2": p2, |
@@ -358,3 +358,50 b' Resolve conflicted graft with rename' | |||||
358 | diff --git a/a b/b |
|
358 | diff --git a/a b/b | |
359 | rename from a |
|
359 | rename from a | |
360 | rename to b |
|
360 | rename to b | |
|
361 | ||||
|
362 | Test simple origin(), with and without args | |||
|
363 | $ hg log -r 'origin()' | |||
|
364 | changeset: 1:5d205f8b35b6 | |||
|
365 | user: bar | |||
|
366 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
367 | summary: 1 | |||
|
368 | ||||
|
369 | changeset: 2:5c095ad7e90f | |||
|
370 | user: test | |||
|
371 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
372 | summary: 2 | |||
|
373 | ||||
|
374 | changeset: 3:4c60f11aa304 | |||
|
375 | user: baz | |||
|
376 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
377 | summary: 3 | |||
|
378 | ||||
|
379 | changeset: 4:9c233e8e184d | |||
|
380 | user: test | |||
|
381 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
382 | summary: 4 | |||
|
383 | ||||
|
384 | changeset: 5:97f8bfe72746 | |||
|
385 | branch: stable | |||
|
386 | parent: 3:4c60f11aa304 | |||
|
387 | user: test | |||
|
388 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
389 | summary: 5 | |||
|
390 | ||||
|
391 | $ hg log -r 'origin(7)' | |||
|
392 | changeset: 2:5c095ad7e90f | |||
|
393 | user: test | |||
|
394 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
395 | summary: 2 | |||
|
396 | ||||
|
397 | Now transplant a graft to test following through copies | |||
|
398 | $ hg up -q 0 | |||
|
399 | $ hg branch -q dev | |||
|
400 | $ hg ci -qm "dev branch" | |||
|
401 | $ hg --config extensions.transplant= transplant -q 7 | |||
|
402 | $ hg log -r 'origin(.)' | |||
|
403 | changeset: 2:5c095ad7e90f | |||
|
404 | user: test | |||
|
405 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
406 | summary: 2 | |||
|
407 |
General Comments 0
You need to be logged in to leave comments.
Login now