##// END OF EJS Templates
journal: add support for seaching by pattern...
Martijn Pieters -
r29504:7503d887 default
parent child Browse files
Show More
@@ -361,11 +361,18 b' class journalstorage(object):'
361 Both the namespace and the name are optional; if neither is given all
361 Both the namespace and the name are optional; if neither is given all
362 entries in the journal are produced.
362 entries in the journal are produced.
363
363
364 Matching supports regular expressions by using the `re:` prefix
365 (use `literal:` to match names or namespaces that start with `re:`)
366
364 """
367 """
368 if namespace is not None:
369 namespace = util.stringmatcher(namespace)[-1]
370 if name is not None:
371 name = util.stringmatcher(name)[-1]
365 for entry in self:
372 for entry in self:
366 if namespace is not None and entry.namespace != namespace:
373 if namespace is not None and not namespace(entry.namespace):
367 continue
374 continue
368 if name is not None and entry.name != name:
375 if name is not None and not name(entry.name):
369 continue
376 continue
370 yield entry
377 yield entry
371
378
@@ -430,6 +437,10 b' def journal(ui, repo, *args, **opts):'
430 bookmarks and the working copy; each line will then include the bookmark
437 bookmarks and the working copy; each line will then include the bookmark
431 name, or '.' for the working copy, as well.
438 name, or '.' for the working copy, as well.
432
439
440 If `name` starts with `re:`, the remainder of the name is treated as
441 a regular expression. To match a name that actually starts with `re:`,
442 use the prefix `literal:`.
443
433 By default hg journal only shows the commit hash and the command that was
444 By default hg journal only shows the commit hash and the command that was
434 running at that time. -v/--verbose will show the prior hash, the user, and
445 running at that time. -v/--verbose will show the prior hash, the user, and
435 the time at which it happened.
446 the time at which it happened.
@@ -471,7 +482,9 b' def journal(ui, repo, *args, **opts):'
471 fm.condwrite(ui.verbose, 'oldhashes', '%s -> ', oldhashesstr)
482 fm.condwrite(ui.verbose, 'oldhashes', '%s -> ', oldhashesstr)
472 fm.write('newhashes', '%s', newhashesstr)
483 fm.write('newhashes', '%s', newhashesstr)
473 fm.condwrite(ui.verbose, 'user', ' %-8s', entry.user)
484 fm.condwrite(ui.verbose, 'user', ' %-8s', entry.user)
474 fm.condwrite(opts.get('all'), 'name', ' %-8s', entry.name)
485 fm.condwrite(
486 opts.get('all') or name.startswith('re:'),
487 'name', ' %-8s', entry.name)
475
488
476 timestring = util.datestr(entry.timestamp, '%Y-%m-%d %H:%M %1%2')
489 timestring = util.datestr(entry.timestamp, '%Y-%m-%d %H:%M %1%2')
477 fm.condwrite(ui.verbose, 'date', ' %s', timestring)
490 fm.condwrite(ui.verbose, 'date', ' %s', timestring)
@@ -123,6 +123,12 b' Test that you can list all entries as we'
123 cb9a9f314b8b up 0
123 cb9a9f314b8b up 0
124 1e6c11564562 commit -Aqm b
124 1e6c11564562 commit -Aqm b
125 cb9a9f314b8b commit -Aqm a
125 cb9a9f314b8b commit -Aqm a
126 $ hg journal "re:ba."
127 previous locations of 're:ba.':
128 1e6c11564562 baz book -r tip baz
129 1e6c11564562 bar up
130 cb9a9f314b8b bar book -f bar
131 1e6c11564562 bar book -r tip bar
126
132
127 Test that verbose, JSON and commit output work
133 Test that verbose, JSON and commit output work
128
134
General Comments 0
You need to be logged in to leave comments. Login now