hgext/journal.py
changeset 29504 7503d8874617
parent 29503 0103b673d6ca
child 29689 12f04946053c
equal deleted inserted replaced
29503:0103b673d6ca 29504:7503d8874617
   359         """Yield all journal entries with the given namespace or name
   359         """Yield all journal entries with the given namespace or name
   360 
   360 
   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 
   372     def __iter__(self):
   379     def __iter__(self):
   373         """Iterate over the storage
   380         """Iterate over the storage
   428     copy.  Passing a bookmark name will show all the previous positions of
   435     copy.  Passing a bookmark name will show all the previous positions of
   429     that bookmark. Use the --all switch to show previous locations for all
   436     that bookmark. Use the --all switch to show previous locations for all
   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.
   436 
   447 
   437     Use -c/--commits to output log information on each commit hash; at this
   448     Use -c/--commits to output log information on each commit hash; at this
   469 
   480 
   470         fm.startitem()
   481         fm.startitem()
   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)
   478         fm.write('command', '  %s\n', entry.command)
   491         fm.write('command', '  %s\n', entry.command)
   479 
   492