Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 8410:1d11d985c179
commit: combine _commitctx and commitctx, drop unused force argument
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 14 May 2009 13:21:20 -0500 |
parents | 223000a687b0 |
children | 4d5916358abd |
comparison
equal
deleted
inserted
replaced
8409:e84a8482c6f2 | 8410:1d11d985c179 |
---|---|
809 if f in ms and ms[f] == 'u': | 809 if f in ms and ms[f] == 'u': |
810 raise util.Abort(_("unresolved merge conflicts " | 810 raise util.Abort(_("unresolved merge conflicts " |
811 "(see hg resolve)")) | 811 "(see hg resolve)")) |
812 wctx = context.workingctx(self, (p1, p2), text, user, date, | 812 wctx = context.workingctx(self, (p1, p2), text, user, date, |
813 extra, changes) | 813 extra, changes) |
814 r = self._commitctx(wctx, force, editor, True) | 814 r = self.commitctx(wctx, editor, True) |
815 ms.reset() | 815 ms.reset() |
816 return r | 816 return r |
817 | 817 |
818 finally: | 818 finally: |
819 wlock.release() | 819 wlock.release() |
820 | 820 |
821 def commitctx(self, ctx): | 821 def commitctx(self, ctx, editor=None, working=False): |
822 """Add a new revision to current repository. | 822 """Add a new revision to current repository. |
823 | 823 |
824 Revision information is passed in the context.memctx argument. | 824 Revision information is passed via the context argument. |
825 commitctx() does not touch the working directory. | 825 If editor is supplied, it is called to get a commit message. |
826 If working is set, the working directory is affected. | |
826 """ | 827 """ |
827 return self._commitctx(ctx, force=True, editor=None, working=False) | 828 |
828 | |
829 def _commitctx(self, ctx, force=False, editor=None, working=True): | |
830 lock = self.lock() | 829 lock = self.lock() |
831 tr = None | 830 tr = None |
832 valid = 0 # don't save the dirstate if this isn't set | 831 valid = 0 # don't save the dirstate if this isn't set |
833 try: | 832 try: |
834 commit = sorted(ctx.modified() + ctx.added()) | 833 commit = sorted(ctx.modified() + ctx.added()) |