Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 8411:4d5916358abd
commit: move lots of commitctx outside of the repo lock
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 14 May 2009 13:21:20 -0500 |
parents | 1d11d985c179 |
children | 2bf4f380f6ab |
comparison
equal
deleted
inserted
replaced
8410:1d11d985c179 | 8411:4d5916358abd |
---|---|
824 Revision information is passed via the context argument. | 824 Revision information is passed via the context argument. |
825 If editor is supplied, it is called to get a commit message. | 825 If editor is supplied, it is called to get a commit message. |
826 If working is set, the working directory is affected. | 826 If working is set, the working directory is affected. |
827 """ | 827 """ |
828 | 828 |
829 lock = self.lock() | |
830 tr = None | 829 tr = None |
831 valid = 0 # don't save the dirstate if this isn't set | 830 valid = 0 # don't save the dirstate if this isn't set |
832 try: | 831 lock = None |
833 commit = sorted(ctx.modified() + ctx.added()) | 832 commit = sorted(ctx.modified() + ctx.added()) |
834 remove = ctx.removed() | 833 remove = ctx.removed() |
835 extra = ctx.extra().copy() | 834 extra = ctx.extra().copy() |
836 branchname = extra['branch'] | 835 branchname = extra['branch'] |
837 user = ctx.user() | 836 user = ctx.user() |
838 text = ctx.description() | 837 text = ctx.description() |
839 | 838 |
840 p1, p2 = [p.node() for p in ctx.parents()] | 839 p1, p2 = [p.node() for p in ctx.parents()] |
841 c1 = self.changelog.read(p1) | 840 c1 = self.changelog.read(p1) |
842 c2 = self.changelog.read(p2) | 841 c2 = self.changelog.read(p2) |
843 m1 = self.manifest.read(c1[0]).copy() | 842 m1 = self.manifest.read(c1[0]).copy() |
844 m2 = self.manifest.read(c2[0]) | 843 m2 = self.manifest.read(c2[0]) |
845 | 844 |
846 xp1 = hex(p1) | 845 xp1 = hex(p1) |
847 if p2 == nullid: xp2 = '' | 846 if p2 == nullid: xp2 = '' |
848 else: xp2 = hex(p2) | 847 else: xp2 = hex(p2) |
849 | 848 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) |
850 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) | 849 |
851 | 850 lock = self.lock() |
851 try: | |
852 tr = self.transaction() | 852 tr = self.transaction() |
853 trp = weakref.proxy(tr) | 853 trp = weakref.proxy(tr) |
854 | 854 |
855 # check in files | 855 # check in files |
856 new = {} | 856 new = {} |