changeset 17003:42c472877825

revset: add a utility for obtaining the source of a given rev graft, transplant and rebase all embed a different type of source marker in extra, and each with a different name. The current implementation of each is such that there will never be more than one of these markers on a node. Note that the rebase marker can only be resolved if the source is still present, which excludes the typical rebase usage (without --keep) from consideration (unless the resulting bundle in strip-backup is overlayed). There probably isn't any reason to use rebase --keep as a substitute for transplant or graft at this point, but maybe there was at one point and there are even a few rebases in the hg repo, so it may be of historical interest.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 05 Jun 2012 20:35:34 -0400
parents 0eb522625eb2
children a1d86396d8c1
files mercurial/revset.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Sun May 13 01:12:26 2012 -0400
+++ b/mercurial/revset.py	Tue Jun 05 20:35:34 2012 -0400
@@ -186,6 +186,16 @@
         raise error.ParseError(_("missing argument"))
     return methods[x[0]](repo, subset, *x[1:])
 
+def _getrevsource(repo, r):
+    extra = repo[r].extra()
+    for label in ('source', 'transplant_source', 'rebase_source'):
+        if label in extra:
+            try:
+                return repo[extra[label]].rev()
+            except error.RepoLookupError:
+                pass
+    return None
+
 # operator methods
 
 def stringset(repo, subset, x):