Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 6709:f84f507c53d3
context: let workingctx.date(), .user() and description() be overriden
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 18 Jun 2008 22:52:26 +0200 |
parents | 7566f00a3979 |
children | 0aa91f69a4c4 |
comparison
equal
deleted
inserted
replaced
6708:7566f00a3979 | 6709:f84f507c53d3 |
---|---|
489 return filelog.filelog(self.sopener, f) | 489 return filelog.filelog(self.sopener, f) |
490 | 490 |
491 def changectx(self, changeid=None): | 491 def changectx(self, changeid=None): |
492 return context.changectx(self, changeid) | 492 return context.changectx(self, changeid) |
493 | 493 |
494 def workingctx(self, parents=None, extra=None, changes=None): | 494 def workingctx(self, parents=None, text="", user=None, date=None, |
495 return context.workingctx(self, parents, extra, changes) | 495 extra=None, changes=None): |
496 return context.workingctx(self, parents, text, user, date, extra, | |
497 changes) | |
496 | 498 |
497 def parents(self, changeid=None): | 499 def parents(self, changeid=None): |
498 ''' | 500 ''' |
499 get list of changectxs for parents of changeid or working directory | 501 get list of changectxs for parents of changeid or working directory |
500 ''' | 502 ''' |
793 else: | 795 else: |
794 p1, p2 = p1, p2 or nullid | 796 p1, p2 = p1, p2 or nullid |
795 update_dirstate = (self.dirstate.parents()[0] == p1) | 797 update_dirstate = (self.dirstate.parents()[0] == p1) |
796 changes = [files, [], [], [], []] | 798 changes = [files, [], [], [], []] |
797 | 799 |
798 wctx = self.workingctx((p1, p2), extra, changes) | 800 wctx = self.workingctx((p1, p2), text, user, date, extra, changes) |
799 commit = wctx.modified() + wctx.added() | 801 commit = wctx.modified() + wctx.added() |
800 remove = wctx.removed() | 802 remove = wctx.removed() |
801 extra = wctx.extra().copy() | 803 extra = wctx.extra().copy() |
802 branchname = extra['branch'] | 804 branchname = extra['branch'] |
805 user = wctx.user() | |
806 text = wctx.description() | |
803 | 807 |
804 c1 = self.changelog.read(p1) | 808 c1 = self.changelog.read(p1) |
805 c2 = self.changelog.read(p2) | 809 c2 = self.changelog.read(p2) |
806 m1 = self.manifest.read(c1[0]).copy() | 810 m1 = self.manifest.read(c1[0]).copy() |
807 m2 = self.manifest.read(c2[0]) | 811 m2 = self.manifest.read(c2[0]) |
866 removed.append(f) | 870 removed.append(f) |
867 mn = self.manifest.add(m1, trp, linkrev, c1[0], c2[0], | 871 mn = self.manifest.add(m1, trp, linkrev, c1[0], c2[0], |
868 (new, removed)) | 872 (new, removed)) |
869 | 873 |
870 # add changeset | 874 # add changeset |
871 user = user or self.ui.username() | |
872 if (not empty_ok and not text) or force_editor: | 875 if (not empty_ok and not text) or force_editor: |
873 edittext = [] | 876 edittext = [] |
874 if text: | 877 if text: |
875 edittext.append(text) | 878 edittext.append(text) |
876 edittext.append("") | 879 edittext.append("") |
899 if not lines and use_dirstate: | 902 if not lines and use_dirstate: |
900 raise util.Abort(_("empty commit message")) | 903 raise util.Abort(_("empty commit message")) |
901 text = '\n'.join(lines) | 904 text = '\n'.join(lines) |
902 | 905 |
903 n = self.changelog.add(mn, changed + removed, text, trp, p1, p2, | 906 n = self.changelog.add(mn, changed + removed, text, trp, p1, p2, |
904 user, date, extra) | 907 user, wctx.date(), extra) |
905 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, | 908 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, |
906 parent2=xp2) | 909 parent2=xp2) |
907 tr.close() | 910 tr.close() |
908 | 911 |
909 if self.branchcache: | 912 if self.branchcache: |