Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 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 | ee2370d866fc |
comparison
equal
deleted
inserted
replaced
17002:0eb522625eb2 | 17003:42c472877825 |
---|---|
184 def getset(repo, subset, x): | 184 def getset(repo, subset, x): |
185 if not x: | 185 if not x: |
186 raise error.ParseError(_("missing argument")) | 186 raise error.ParseError(_("missing argument")) |
187 return methods[x[0]](repo, subset, *x[1:]) | 187 return methods[x[0]](repo, subset, *x[1:]) |
188 | 188 |
189 def _getrevsource(repo, r): | |
190 extra = repo[r].extra() | |
191 for label in ('source', 'transplant_source', 'rebase_source'): | |
192 if label in extra: | |
193 try: | |
194 return repo[extra[label]].rev() | |
195 except error.RepoLookupError: | |
196 pass | |
197 return None | |
198 | |
189 # operator methods | 199 # operator methods |
190 | 200 |
191 def stringset(repo, subset, x): | 201 def stringset(repo, subset, x): |
192 x = repo[x].rev() | 202 x = repo[x].rev() |
193 if x == -1 and len(subset) == len(repo): | 203 if x == -1 and len(subset) == len(repo): |