##// END OF EJS Templates
annotate: add a new experimental --skip option to skip revs...
Siddharth Agarwal -
r32486:1df80eff default
parent child Browse files
Show More
@@ -262,7 +262,8 b' def addremove(ui, repo, *pats, **opts):'
262 ('d', 'date', None, _('list the date (short with -q)')),
262 ('d', 'date', None, _('list the date (short with -q)')),
263 ('n', 'number', None, _('list the revision number (default)')),
263 ('n', 'number', None, _('list the revision number (default)')),
264 ('c', 'changeset', None, _('list the changeset')),
264 ('c', 'changeset', None, _('list the changeset')),
265 ('l', 'line-number', None, _('show line number at the first appearance'))
265 ('l', 'line-number', None, _('show line number at the first appearance')),
266 ('', 'skip', [], _('revision to not display (EXPERIMENTAL)'), _('REV')),
266 ] + diffwsopts + walkopts + formatteropts,
267 ] + diffwsopts + walkopts + formatteropts,
267 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
268 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
268 inferrepo=True)
269 inferrepo=True)
@@ -368,6 +369,10 b' def annotate(ui, repo, *pats, **opts):'
368 follow = not opts.get('no_follow')
369 follow = not opts.get('no_follow')
369 diffopts = patch.difffeatureopts(ui, opts, section='annotate',
370 diffopts = patch.difffeatureopts(ui, opts, section='annotate',
370 whitespace=True)
371 whitespace=True)
372 skiprevs = opts.get('skip')
373 if skiprevs:
374 skiprevs = scmutil.revrange(repo, skiprevs)
375
371 for abs in ctx.walk(m):
376 for abs in ctx.walk(m):
372 fctx = ctx[abs]
377 fctx = ctx[abs]
373 if not opts.get('text') and fctx.isbinary():
378 if not opts.get('text') and fctx.isbinary():
@@ -375,7 +380,7 b' def annotate(ui, repo, *pats, **opts):'
375 continue
380 continue
376
381
377 lines = fctx.annotate(follow=follow, linenumber=linenumber,
382 lines = fctx.annotate(follow=follow, linenumber=linenumber,
378 diffopts=diffopts)
383 skiprevs=skiprevs, diffopts=diffopts)
379 if not lines:
384 if not lines:
380 continue
385 continue
381 formats = []
386 formats = []
@@ -949,7 +949,8 b' class basefilectx(object):'
949 return p[1]
949 return p[1]
950 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
950 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
951
951
952 def annotate(self, follow=False, linenumber=False, diffopts=None):
952 def annotate(self, follow=False, linenumber=False, skiprevs=None,
953 diffopts=None):
953 '''returns a list of tuples of ((ctx, number), line) for each line
954 '''returns a list of tuples of ((ctx, number), line) for each line
954 in the file, where ctx is the filectx of the node where
955 in the file, where ctx is the filectx of the node where
955 that line was last changed; if linenumber parameter is true, number is
956 that line was last changed; if linenumber parameter is true, number is
@@ -1044,7 +1045,10 b' class basefilectx(object):'
1044 if ready:
1045 if ready:
1045 visit.pop()
1046 visit.pop()
1046 curr = decorate(f.data(), f)
1047 curr = decorate(f.data(), f)
1047 curr = _annotatepair([hist[p] for p in pl], f, curr, False,
1048 skipchild = False
1049 if skiprevs is not None:
1050 skipchild = f._changeid in skiprevs
1051 curr = _annotatepair([hist[p] for p in pl], f, curr, skipchild,
1048 diffopts)
1052 diffopts)
1049 for p in pl:
1053 for p in pl:
1050 if needed[p] == 1:
1054 if needed[p] == 1:
@@ -217,6 +217,77 b' annotate after rename merge with -l'
217 3 b:5: b5
217 3 b:5: b5
218 7 b:7: d
218 7 b:7: d
219
219
220 --skip nothing (should be the same as no --skip at all)
221
222 $ hg annotate -nlf b --skip '1::0'
223 0 a:1: a
224 6 b:2: z
225 1 a:3: a
226 3 b:4: b4
227 4 b:5: c
228 3 b:5: b5
229 7 b:7: d
230
231 --skip a modified line
232
233 $ hg annotate -nlf b --skip 6
234 0 a:1: a
235 1 a:2: z
236 1 a:3: a
237 3 b:4: b4
238 4 b:5: c
239 3 b:5: b5
240 7 b:7: d
241
242 --skip added lines (and test multiple skip)
243
244 $ hg annotate -nlf b --skip 3
245 0 a:1: a
246 6 b:2: z
247 1 a:3: a
248 1 a:3: b4
249 4 b:5: c
250 1 a:3: b5
251 7 b:7: d
252
253 $ hg annotate -nlf b --skip 4
254 0 a:1: a
255 6 b:2: z
256 1 a:3: a
257 3 b:4: b4
258 1 a:3: c
259 3 b:5: b5
260 7 b:7: d
261
262 $ hg annotate -nlf b --skip 3 --skip 4
263 0 a:1: a
264 6 b:2: z
265 1 a:3: a
266 1 a:3: b4
267 1 a:3: c
268 1 a:3: b5
269 7 b:7: d
270
271 $ hg annotate -nlf b --skip 'merge()'
272 0 a:1: a
273 6 b:2: z
274 1 a:3: a
275 3 b:4: b4
276 4 b:5: c
277 3 b:5: b5
278 3 b:5: d
279
280 --skip everything -- use the revision the file was introduced in
281
282 $ hg annotate -nlf b --skip 'all()'
283 0 a:1: a
284 0 a:1: z
285 0 a:1: a
286 0 a:1: b4
287 0 a:1: c
288 0 a:1: b5
289 0 a:1: d
290
220 Issue2807: alignment of line numbers with -l
291 Issue2807: alignment of line numbers with -l
221
292
222 $ echo more >> b
293 $ echo more >> b
@@ -217,7 +217,7 b' Show an error if we use --options with a'
217 Show all commands + options
217 Show all commands + options
218 $ hg debugcommands
218 $ hg debugcommands
219 add: include, exclude, subrepos, dry-run
219 add: include, exclude, subrepos, dry-run
220 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template
220 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template
221 clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
221 clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
222 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
222 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
223 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, root, include, exclude, subrepos
223 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, root, include, exclude, subrepos
General Comments 0
You need to be logged in to leave comments. Login now