##// END OF EJS Templates
Add log option --follow-first to follow only the first parent of...
Brendan Cully -
r2784:12a7bfca default
parent child Browse files
Show More
@@ -125,7 +125,7 b' def walkchangerevs(ui, repo, pats, opts)'
125
125
126
126
127 files, matchfn, anypats = matchpats(repo, pats, opts)
127 files, matchfn, anypats = matchpats(repo, pats, opts)
128 follow = opts.get('follow')
128 follow = opts.get('follow') or opts.get('follow_first')
129
129
130 if repo.changelog.count() == 0:
130 if repo.changelog.count() == 0:
131 return [], False, matchfn
131 return [], False, matchfn
@@ -217,13 +217,17 b' def walkchangerevs(ui, repo, pats, opts)'
217
217
218 def iterate():
218 def iterate():
219 class followfilter:
219 class followfilter:
220 def __init__(self):
220 def __init__(self, onlyfirst=False):
221 self.startrev = -1
221 self.startrev = -1
222 self.roots = []
222 self.roots = []
223 self.onlyfirst = onlyfirst
223
224
224 def match(self, rev):
225 def match(self, rev):
225 def realparents(rev):
226 def realparents(rev):
226 return filter(lambda x: x != -1, repo.changelog.parentrevs(rev))
227 if self.onlyfirst:
228 return repo.changelog.parentrevs(rev)[0:1]
229 else:
230 return filter(lambda x: x != -1, repo.changelog.parentrevs(rev))
227
231
228 if self.startrev == -1:
232 if self.startrev == -1:
229 self.startrev = rev
233 self.startrev = rev
@@ -249,7 +253,7 b' def walkchangerevs(ui, repo, pats, opts)'
249 return False
253 return False
250
254
251 if follow and not files:
255 if follow and not files:
252 ff = followfilter()
256 ff = followfilter(onlyfirst=opts.get('follow_first'))
253 def want(rev):
257 def want(rev):
254 if rev not in wanted:
258 if rev not in wanted:
255 return False
259 return False
@@ -2025,7 +2029,8 b' def log(ui, repo, *pats, **opts):'
2025 File history is shown without following rename or copy history of
2029 File history is shown without following rename or copy history of
2026 files. Use -f/--follow with a file name to follow history across
2030 files. Use -f/--follow with a file name to follow history across
2027 renames and copies. --follow without a file name will only show
2031 renames and copies. --follow without a file name will only show
2028 ancestors or descendants of the starting revision.
2032 ancestors or descendants of the starting revision. --follow-first
2033 only follows the first parent of merge revisions.
2029
2034
2030 If no revision range is specified, the default is tip:0 unless
2035 If no revision range is specified, the default is tip:0 unless
2031 --follow is set, in which case the working directory parent is
2036 --follow is set, in which case the working directory parent is
@@ -3144,6 +3149,8 b' table = {'
3144 [('b', 'branches', None, _('show branches')),
3149 [('b', 'branches', None, _('show branches')),
3145 ('f', 'follow', None,
3150 ('f', 'follow', None,
3146 _('follow changeset history, or file history across copies and renames')),
3151 _('follow changeset history, or file history across copies and renames')),
3152 ('', 'follow-first', None,
3153 _('only follow the first parent of merge changesets')),
3147 ('k', 'keyword', [], _('search for a keyword')),
3154 ('k', 'keyword', [], _('search for a keyword')),
3148 ('l', 'limit', '', _('limit number of changes displayed')),
3155 ('l', 'limit', '', _('limit number of changes displayed')),
3149 ('r', 'rev', [], _('show the specified revision or range')),
3156 ('r', 'rev', [], _('show the specified revision or range')),
General Comments 0
You need to be logged in to leave comments. Login now