##// END OF EJS Templates
Make log --follow without a file list follow a single head....
Brendan Cully -
r2782:21e571c2 default
parent child Browse files
Show More
@@ -206,10 +206,51 b' def walkchangerevs(ui, repo, pats, opts)'
206 wanted[rev] = 1
206 wanted[rev] = 1
207
207
208 def iterate():
208 def iterate():
209 class followfilter:
210 def __init__(self):
211 self.startrev = -1
212 self.roots = []
213
214 def match(self, rev):
215 def realparents(rev):
216 return filter(lambda x: x != -1, repo.changelog.parentrevs(rev))
217
218 if self.startrev == -1:
219 self.startrev = rev
220 return True
221
222 if rev > self.startrev:
223 # forward: all descendants
224 if not self.roots:
225 self.roots.append(self.startrev)
226 for parent in realparents(rev):
227 if parent in self.roots:
228 self.roots.append(rev)
229 return True
230 else:
231 # backwards: all parents
232 if not self.roots:
233 self.roots.extend(realparents(self.startrev))
234 if rev in self.roots:
235 self.roots.remove(rev)
236 self.roots.extend(realparents(rev))
237 return True
238
239 return False
240
241 if follow and not files:
242 ff = followfilter()
243 def want(rev):
244 if rev not in wanted:
245 return False
246 return ff.match(rev)
247 else:
248 def want(rev):
249 return rev in wanted
250
209 for i, window in increasing_windows(0, len(revs)):
251 for i, window in increasing_windows(0, len(revs)):
210 yield 'window', revs[0] < revs[-1], revs[-1]
252 yield 'window', revs[0] < revs[-1], revs[-1]
211 nrevs = [rev for rev in revs[i:i+window]
253 nrevs = [rev for rev in revs[i:i+window] if want(rev)]
212 if rev in wanted]
213 srevs = list(nrevs)
254 srevs = list(nrevs)
214 srevs.sort()
255 srevs.sort()
215 for rev in srevs:
256 for rev in srevs:
@@ -1972,8 +2013,9 b' def log(ui, repo, *pats, **opts):'
1972 project.
2013 project.
1973
2014
1974 File history is shown without following rename or copy history of
2015 File history is shown without following rename or copy history of
1975 files. Use -f/--follow to follow history across renames and
2016 files. Use -f/--follow with a file name to follow history across
1976 copies.
2017 renames and copies. --follow without a file name will only show
2018 ancestors or descendants of the starting revision.
1977
2019
1978 By default this command outputs: changeset id and hash, tags,
2020 By default this command outputs: changeset id and hash, tags,
1979 non-trivial parents, user, date and time, and a summary for each
2021 non-trivial parents, user, date and time, and a summary for each
@@ -3087,7 +3129,7 b' table = {'
3087 (log,
3129 (log,
3088 [('b', 'branches', None, _('show branches')),
3130 [('b', 'branches', None, _('show branches')),
3089 ('f', 'follow', None,
3131 ('f', 'follow', None,
3090 _('follow file history across copies and renames')),
3132 _('follow changeset history, or file history across copies and renames')),
3091 ('k', 'keyword', [], _('search for a keyword')),
3133 ('k', 'keyword', [], _('search for a keyword')),
3092 ('l', 'limit', '', _('limit number of changes displayed')),
3134 ('l', 'limit', '', _('limit number of changes displayed')),
3093 ('r', 'rev', [], _('show the specified revision or range')),
3135 ('r', 'rev', [], _('show the specified revision or range')),
General Comments 0
You need to be logged in to leave comments. Login now