Mercurial > python-hglib
diff hglib/client.py @ 52:18f72b255553
client: add annotate command
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Fri, 19 Aug 2011 19:46:11 +0300 |
parents | c52383a550fb |
children | 066dfa5c0b70 |
line wrap: on
line diff
--- a/hglib/client.py Thu Aug 18 16:23:43 2011 +0300 +++ b/hglib/client.py Fri Aug 19 19:46:11 2011 +0300 @@ -173,6 +173,26 @@ return bool(eh) + def annotate(self, files, rev=None, nofollow=False, text=False, user=False, + file=False, date=False, number=False, changeset=False, + line=False, verbose=False, include=None, exclude=None): + """ + Show changeset information by line for each file in files. + + yields a (info, contents) tuple for each line in a file + """ + if not isinstance(files, list): + files = [files] + + args = cmdbuilder('annotate', *files, r=rev, no_follow=nofollow, a=text, + u=user, f=file, d=date, n=number, c=changeset, l=line, + v=verbose, I=include, X=exclude) + + out = self.rawcommand(args) + + for line in out.splitlines(): + yield tuple(line.split(': ', 1)) + def backout(self, rev, merge=False, parent=None, tool=None, message=None, logfile=None, date=None, user=None): if message and logfile: