[PATCH V3] revrange: don't parse revset aliases as hash prefixes (issue4553)
Yuya Nishihara
yuya at tcha.org
Tue Mar 3 07:54:36 CST 2015
On Mon, 02 Mar 2015 13:28:32 -0500, Jordi GutiƩrrez Hermoso wrote:
> On Sat, 2015-02-28 at 18:04 +0900, Yuya Nishihara wrote:
> > On Sat, 28 Feb 2015 12:37:19 +0900, Yuya Nishihara wrote:
> > > I don't know which is better, but both "x in revsetliases" checks can be done
> > > by revfix().
> >
> > Oops, my suggestion didn't work because "spec in repo" may raise LookupError.
> > It seems "spec in repo" is unnecessary, though.
>
> I don't understand what you're suggesting with revfix. Do you think I
> can ignore your suggestion? :-)
Yes, it's not important. Just it could be written as follows.
+ revsetaliases = [alias for (alias, _definition) in
+ repo.ui.configitems("revsetalias")]
+
def revfix(repo, val, defval):
if not val and val != 0 and defval is not None:
return defval
+ if val in revsetaliases:
+ raise error.RepoLookupError
return repo[val].rev()
@@ -659,7 +665,7 @@ def revrange(repo, revs):
seen = newrevs
l = l + revset.baseset(sorted(newrevs, reverse=start > end))
continue
- elif spec and spec in repo: # single unquoted rev
+ elif spec: # single unquoted rev
rev = revfix(repo, spec, None)
if rev in seen:
continue
More information about the Mercurial-devel
mailing list