Mercurial > public > mercurial-scm > hg-stable
diff hgext/graphlog.py @ 16409:2cbd7dd0cc1f
graphlog: fix --follow-first --rev combinations
This solves a similar problem than the previous --follow/--rev patch. This time
we need changelog.ancestors()/descendants() filtering on first parent.
Duplicating the code looked better than introducing keyword arguments. Besides,
the ancestors() version was already implemented in follow() revset.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Wed, 11 Apr 2012 11:25:34 +0200 |
parents | d74099ac2ac1 |
children | 4c2edcd84175 |
line wrap: on
line diff
--- a/hgext/graphlog.py Wed Apr 11 11:22:40 2012 +0200 +++ b/hgext/graphlog.py Wed Apr 11 11:25:34 2012 +0200 @@ -279,11 +279,12 @@ the files to be detailed when displaying the revision. """ opt2revset = { - 'follow_first': ('_followfirst()', None), 'no_merges': ('not merge()', None), 'only_merges': ('merge()', None), '_ancestors': ('ancestors(%(val)s)', None), + '_fancestors': ('_firstancestors(%(val)s)', None), '_descendants': ('descendants(%(val)s)', None), + '_fdescendants': ('_firstdescendants(%(val)s)', None), '_matchfiles': ('_matchfiles(%(val)s)', None), 'date': ('date(%(val)r)', None), 'branch': ('branch(%(val)r)', ' or '), @@ -299,8 +300,6 @@ # follow or not follow? follow = opts.get('follow') or opts.get('follow_first') followfirst = opts.get('follow_first') - if 'follow_first' in opts: - del opts['follow_first'] # --follow with FILE behaviour depends on revs... startrev = revs[0] followdescendants = len(revs) > 1 and revs[0] < revs[1] @@ -356,7 +355,10 @@ if pats: opts['_patsfollowfirst'] = list(pats) else: - opts['follow_first'] = True + if followdescendants: + opts['_fdescendants'] = str(startrev) + else: + opts['_fancestors'] = str(startrev) else: if pats: opts['_patsfollow'] = list(pats)