Mercurial > python-hglib
comparison hglib/client.py @ 34:f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Sun, 14 Aug 2011 00:51:15 +0300 |
parents | d74a5891d9d1 |
children | 1e33bbea23e5 |
comparison
equal
deleted
inserted
replaced
33:d74a5891d9d1 | 34:f6e1d9a6e0cd |
---|---|
519 def status(self, rev=None, change=None, all=False, modified=False, added=False, | 519 def status(self, rev=None, change=None, all=False, modified=False, added=False, |
520 removed=False, deleted=False, clean=False, unknown=False, | 520 removed=False, deleted=False, clean=False, unknown=False, |
521 ignored=False, copies=False, subrepos=False, include=None, | 521 ignored=False, copies=False, subrepos=False, include=None, |
522 exclude=None): | 522 exclude=None): |
523 """ | 523 """ |
524 Return a dictionary with the following keys: | 524 Return a list of (code, file path) where code can be: |
525 | 525 |
526 M = modified | 526 M = modified |
527 A = added | 527 A = added |
528 R = removed | 528 R = removed |
529 C = clean | 529 C = clean |
530 ! = missing (deleted by non-hg command, but still tracked) | 530 ! = missing (deleted by non-hg command, but still tracked) |
531 ? = untracked | 531 ? = untracked |
532 I = ignored | 532 I = ignored |
533 = origin of the previous file listed as A (added) | 533 = origin of the previous file listed as A (added) |
534 | |
535 And a list of files to match as values. | |
536 """ | 534 """ |
537 if rev and change: | 535 if rev and change: |
538 raise ValueError('cannot specify both rev and change') | 536 raise ValueError('cannot specify both rev and change') |
539 | 537 |
540 args = cmdbuilder('status', rev=rev, change=change, A=all, m=modified, | 538 args = cmdbuilder('status', rev=rev, change=change, A=all, m=modified, |
542 i=ignored, C=copies, S=subrepos, I=include, X=exclude) | 540 i=ignored, C=copies, S=subrepos, I=include, X=exclude) |
543 | 541 |
544 args.append('-0') | 542 args.append('-0') |
545 | 543 |
546 out = self.rawcommand(args) | 544 out = self.rawcommand(args) |
547 d = dict((c, []) for c in 'MARC!?I') | 545 l = [] |
548 | 546 |
549 for entry in out.split('\0'): | 547 for entry in out.split('\0'): |
550 if entry: | 548 if entry: |
551 t, f = entry.split(' ', 1) | 549 l.append(tuple(entry.rsplit(' ', 1))) |
552 d[t].append(f) | 550 |
553 | 551 return l |
554 return d | |
555 | 552 |
556 def tip(self): | 553 def tip(self): |
557 args = cmdbuilder('tip', template=templates.changeset) | 554 args = cmdbuilder('tip', template=templates.changeset) |
558 out = self.rawcommand(args) | 555 out = self.rawcommand(args) |
559 out = out.split('\0') | 556 out = out.split('\0') |