diff tests/test-graft.t @ 17186:a3da6f298592

revset: add destination() predicate This predicate is used to find csets that were created because of a graft, transplant or rebase --keep. An optional revset can be supplied, in which case the result will be limited to those copies which specified one of the revs as the source for the command. hg log -r destination() # csets copied from anywhere hg log -r destination(branch(default)) # all csets copied from default hg log -r origin(x) or destination(origin(x)) # all instances of x This predicate will follow a cset through different types of copies. Given a repo with a cset 'S' that is grafted to create G(S), which itself is transplanted to become T(G(S)): o-S / o-o-G(S) \ o-T(G(S)) hg log -r destination( S ) # { G(S), T(G(S)) } hg log -r destination( G(S) ) # { T(G(S)) } The implementation differences between the three different copy commands (see the origin() predicate) are not intentionally exposed, however if the transplant was a graft instead: hg log -r destination( G(S) ) # {} because the 'extra' field in G(G(S)) is S, not G(S). The implementation cannot correct this by following sources before G(S) and then select the csets that reference those sources because the cset provided to the predicate would also end up selected. If there were more than two copies, sources of the argument would also get selected. Note that the convert extension does not currently update the 'extra' map in its destination csets, and therefore copies made prior to the convert will be missing from the resulting set. Instead of the loop over 'subset', the following almost works, but does not select a transplant of a transplant. That is, 'destination(S)' will only select T(S). dests = set([r for r in subset if _getrevsource(repo, r) in args])
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 07 Jul 2012 00:47:55 -0400
parents 2c7c4824969e
children a6fe1b9cc68f
line wrap: on
line diff
--- a/tests/test-graft.t	Sat Jul 07 00:47:30 2012 -0400
+++ b/tests/test-graft.t	Sat Jul 07 00:47:55 2012 -0400
@@ -405,3 +405,131 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
+Test simple destination
+  $ hg log -r 'destination()'
+  changeset:   7:ef0ef43d49e7
+  parent:      0:68795b066622
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   8:6b9e5368ca4e
+  user:        bar
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     1
+  
+  changeset:   9:1905859650ec
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     5
+  
+  changeset:   10:52dc0b4c6907
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     4
+  
+  changeset:   11:882b35362a6b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     3
+  
+  changeset:   13:9db0f28fd374
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   14:f64defefacee
+  parent:      1:5d205f8b35b6
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     3
+  
+  changeset:   17:64ecd9071ce8
+  user:        bar
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     1
+  
+  changeset:   19:2e80e1351d6e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   21:7e61b508e709
+  branch:      dev
+  tag:         tip
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  $ hg log -r 'destination(2)'
+  changeset:   7:ef0ef43d49e7
+  parent:      0:68795b066622
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   13:9db0f28fd374
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   19:2e80e1351d6e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   21:7e61b508e709
+  branch:      dev
+  tag:         tip
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+Transplants of grafts can find a destination...
+  $ hg log -r 'destination(7)'
+  changeset:   21:7e61b508e709
+  branch:      dev
+  tag:         tip
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+... grafts of grafts unfortunately can't
+  $ hg graft -q 13
+  $ hg log -r 'destination(13)'
+All copies of a cset
+  $ hg log -r 'origin(13) or destination(origin(13))'
+  changeset:   2:5c095ad7e90f
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   7:ef0ef43d49e7
+  parent:      0:68795b066622
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   13:9db0f28fd374
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   19:2e80e1351d6e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   21:7e61b508e709
+  branch:      dev
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+  
+  changeset:   22:1313d0a825e2
+  branch:      dev
+  tag:         tip
+  user:        foo
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     2
+