comparison mercurial/hg.py @ 813:80fd2958235a

Adapt commit to use file matching code. The code is slightly complicated by the need to commit all outstanding changes in the repository if no file names are given (other commands operate on the current directory and its subdirectories in this case). localrepository.changes has acquired an optional match parameter, to let it filter out include/exclude options.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 29 Jul 2005 15:02:27 -0800
parents 902b12d55751
children 0902ffece4b4
comparison
equal deleted inserted replaced
812:b65af904d6d7 813:80fd2958235a
771 n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date) 771 n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date)
772 tr.close() 772 tr.close()
773 if update_dirstate: 773 if update_dirstate:
774 self.dirstate.setparents(n, nullid) 774 self.dirstate.setparents(n, nullid)
775 775
776 def commit(self, files = None, text = "", user = None, date = None): 776 def commit(self, files = None, text = "", user = None, date = None,
777 match = util.always):
777 commit = [] 778 commit = []
778 remove = [] 779 remove = []
779 if files: 780 if files:
780 for f in files: 781 for f in files:
781 s = self.dirstate.state(f) 782 s = self.dirstate.state(f)
784 elif s == 'r': 785 elif s == 'r':
785 remove.append(f) 786 remove.append(f)
786 else: 787 else:
787 self.ui.warn("%s not tracked!\n" % f) 788 self.ui.warn("%s not tracked!\n" % f)
788 else: 789 else:
789 (c, a, d, u) = self.changes() 790 (c, a, d, u) = self.changes(match = match)
790 commit = c + a 791 commit = c + a
791 remove = d 792 remove = d
792 793
793 if not commit and not remove: 794 if not commit and not remove:
794 self.ui.status("nothing changed\n") 795 self.ui.status("nothing changed\n")