comparison mercurial/hg.py @ 900:ba8cf1f2210c

Add force option to repo.commit, allowing commits where no files change
author mason@suse.com
date Sun, 14 Aug 2005 20:08:35 -0800
parents 3616c0d7ab88
children 120cba94d5aa
comparison
equal deleted inserted replaced
899:aa5b726e9619 900:ba8cf1f2210c
854 tr.close() 854 tr.close()
855 if update_dirstate: 855 if update_dirstate:
856 self.dirstate.setparents(n, nullid) 856 self.dirstate.setparents(n, nullid)
857 857
858 def commit(self, files = None, text = "", user = None, date = None, 858 def commit(self, files = None, text = "", user = None, date = None,
859 match = util.always): 859 match = util.always, force=False):
860 commit = [] 860 commit = []
861 remove = [] 861 remove = []
862 if files: 862 if files:
863 for f in files: 863 for f in files:
864 s = self.dirstate.state(f) 864 s = self.dirstate.state(f)
871 else: 871 else:
872 (c, a, d, u) = self.changes(match = match) 872 (c, a, d, u) = self.changes(match = match)
873 commit = c + a 873 commit = c + a
874 remove = d 874 remove = d
875 875
876 if not commit and not remove: 876 if not commit and not remove and not force:
877 self.ui.status("nothing changed\n") 877 self.ui.status("nothing changed\n")
878 return 878 return
879 879
880 if not self.hook("precommit"): 880 if not self.hook("precommit"):
881 return 1 881 return 1