Show More
@@ -19,7 +19,7 b" def fetch(ui, repo, source='default', **" | |||||
19 | merged, and the result of the merge is committed. Otherwise, the |
|
19 | merged, and the result of the merge is committed. Otherwise, the | |
20 | working directory is updated.''' |
|
20 | working directory is updated.''' | |
21 |
|
21 | |||
22 | def postincoming(other, modheads): |
|
22 | def postincoming(other, modheads, lock, wlock): | |
23 | if modheads == 0: |
|
23 | if modheads == 0: | |
24 | return 0 |
|
24 | return 0 | |
25 | if modheads == 1: |
|
25 | if modheads == 1: | |
@@ -50,7 +50,7 b" def fetch(ui, repo, source='default', **" | |||||
50 | ui.status(_('new changeset %d:%s merges remote changes ' |
|
50 | ui.status(_('new changeset %d:%s merges remote changes ' | |
51 | 'with local\n') % (repo.changelog.rev(n), |
|
51 | 'with local\n') % (repo.changelog.rev(n), | |
52 | short(n))) |
|
52 | short(n))) | |
53 | def pull(): |
|
53 | def pull(lock, wlock): | |
54 | cmdutil.setremoteconfig(ui, opts) |
|
54 | cmdutil.setremoteconfig(ui, opts) | |
55 |
|
55 | |||
56 | other = hg.repository(ui, ui.expandpath(source)) |
|
56 | other = hg.repository(ui, ui.expandpath(source)) | |
@@ -61,7 +61,7 b" def fetch(ui, repo, source='default', **" | |||||
61 | elif opts['rev']: |
|
61 | elif opts['rev']: | |
62 | revs = [other.lookup(rev) for rev in opts['rev']] |
|
62 | revs = [other.lookup(rev) for rev in opts['rev']] | |
63 | modheads = repo.pull(other, heads=revs, lock=lock) |
|
63 | modheads = repo.pull(other, heads=revs, lock=lock) | |
64 | return postincoming(other, modheads) |
|
64 | return postincoming(other, modheads, lock, wlock) | |
65 |
|
65 | |||
66 | parent, p2 = repo.dirstate.parents() |
|
66 | parent, p2 = repo.dirstate.parents() | |
67 | if parent != repo.changelog.tip(): |
|
67 | if parent != repo.changelog.tip(): | |
@@ -69,19 +69,19 b" def fetch(ui, repo, source='default', **" | |||||
69 | '(use "hg update" to check out tip)')) |
|
69 | '(use "hg update" to check out tip)')) | |
70 | if p2 != nullid: |
|
70 | if p2 != nullid: | |
71 | raise util.Abort(_('outstanding uncommitted merge')) |
|
71 | raise util.Abort(_('outstanding uncommitted merge')) | |
|
72 | wlock = lock = None | |||
|
73 | try: | |||
72 | wlock = repo.wlock() |
|
74 | wlock = repo.wlock() | |
73 | lock = repo.lock() |
|
75 | lock = repo.lock() | |
74 | try: |
|
|||
75 | mod, add, rem = repo.status(wlock=wlock)[:3] |
|
76 | mod, add, rem = repo.status(wlock=wlock)[:3] | |
76 | if mod or add or rem: |
|
77 | if mod or add or rem: | |
77 | raise util.Abort(_('outstanding uncommitted changes')) |
|
78 | raise util.Abort(_('outstanding uncommitted changes')) | |
78 | if len(repo.heads()) > 1: |
|
79 | if len(repo.heads()) > 1: | |
79 | raise util.Abort(_('multiple heads in this repository ' |
|
80 | raise util.Abort(_('multiple heads in this repository ' | |
80 | '(use "hg heads" and "hg merge" to merge)')) |
|
81 | '(use "hg heads" and "hg merge" to merge)')) | |
81 | return pull() |
|
82 | return pull(lock, wlock) | |
82 | finally: |
|
83 | finally: | |
83 | lock.release() |
|
84 | del lock, wlock | |
84 | wlock.release() |
|
|||
85 |
|
85 | |||
86 | cmdtable = { |
|
86 | cmdtable = { | |
87 | 'fetch': |
|
87 | 'fetch': |
@@ -439,6 +439,8 b' class queue:' | |||||
439 | def apply(self, repo, series, list=False, update_status=True, |
|
439 | def apply(self, repo, series, list=False, update_status=True, | |
440 | strict=False, patchdir=None, merge=None, wlock=None, |
|
440 | strict=False, patchdir=None, merge=None, wlock=None, | |
441 | all_files={}): |
|
441 | all_files={}): | |
|
442 | lock = tr = None | |||
|
443 | try: | |||
442 | if not wlock: |
|
444 | if not wlock: | |
443 | wlock = repo.wlock() |
|
445 | wlock = repo.wlock() | |
444 | lock = repo.lock() |
|
446 | lock = repo.lock() | |
@@ -457,6 +459,8 b' class queue:' | |||||
457 | repo.invalidate() |
|
459 | repo.invalidate() | |
458 | repo.dirstate.invalidate() |
|
460 | repo.dirstate.invalidate() | |
459 | raise |
|
461 | raise | |
|
462 | finally: | |||
|
463 | del lock, wlock, tr | |||
460 |
|
464 | |||
461 | def _apply(self, tr, repo, series, list=False, update_status=True, |
|
465 | def _apply(self, tr, repo, series, list=False, update_status=True, | |
462 | strict=False, patchdir=None, merge=None, wlock=None, |
|
466 | strict=False, patchdir=None, merge=None, wlock=None, | |
@@ -616,6 +620,7 b' class queue:' | |||||
616 | commitfiles = m + a + r |
|
620 | commitfiles = m + a + r | |
617 | self.check_toppatch(repo) |
|
621 | self.check_toppatch(repo) | |
618 | wlock = repo.wlock() |
|
622 | wlock = repo.wlock() | |
|
623 | try: | |||
619 | insert = self.full_series_end() |
|
624 | insert = self.full_series_end() | |
620 | if msg: |
|
625 | if msg: | |
621 | n = repo.commit(commitfiles, msg, force=True, wlock=wlock) |
|
626 | n = repo.commit(commitfiles, msg, force=True, wlock=wlock) | |
@@ -640,8 +645,12 b' class queue:' | |||||
640 | if commitfiles: |
|
645 | if commitfiles: | |
641 | self.refresh(repo, short=True) |
|
646 | self.refresh(repo, short=True) | |
642 | self.removeundo(repo) |
|
647 | self.removeundo(repo) | |
|
648 | finally: | |||
|
649 | del wlock | |||
643 |
|
650 | |||
644 | def strip(self, repo, rev, update=True, backup="all", wlock=None): |
|
651 | def strip(self, repo, rev, update=True, backup="all", wlock=None): | |
|
652 | lock = None | |||
|
653 | try: | |||
645 | if not wlock: |
|
654 | if not wlock: | |
646 | wlock = repo.wlock() |
|
655 | wlock = repo.wlock() | |
647 | lock = repo.lock() |
|
656 | lock = repo.lock() | |
@@ -654,6 +663,8 b' class queue:' | |||||
654 |
|
663 | |||
655 | self.removeundo(repo) |
|
664 | self.removeundo(repo) | |
656 | repair.strip(self.ui, repo, rev, backup) |
|
665 | repair.strip(self.ui, repo, rev, backup) | |
|
666 | finally: | |||
|
667 | del lock, wlock | |||
657 |
|
668 | |||
658 | def isapplied(self, patch): |
|
669 | def isapplied(self, patch): | |
659 | """returns (index, rev, patch)""" |
|
670 | """returns (index, rev, patch)""" | |
@@ -740,27 +751,30 b' class queue:' | |||||
740 | mergeq=None, wlock=None): |
|
751 | mergeq=None, wlock=None): | |
741 | if not wlock: |
|
752 | if not wlock: | |
742 | wlock = repo.wlock() |
|
753 | wlock = repo.wlock() | |
|
754 | try: | |||
743 | patch = self.lookup(patch) |
|
755 | patch = self.lookup(patch) | |
744 |
# Suppose our series file is: A B C and the current 'top' |
|
756 | # Suppose our series file is: A B C and the current 'top' | |
745 | # qpush C should be performed (moving forward) |
|
757 | # patch is B. qpush C should be performed (moving forward) | |
746 | # qpush B is a NOP (no change) |
|
758 | # qpush B is a NOP (no change) qpush A is an error (can't | |
747 |
|
|
759 | # go backwards with qpush) | |
748 | if patch: |
|
760 | if patch: | |
749 | info = self.isapplied(patch) |
|
761 | info = self.isapplied(patch) | |
750 | if info: |
|
762 | if info: | |
751 | if info[0] < len(self.applied) - 1: |
|
763 | if info[0] < len(self.applied) - 1: | |
752 |
raise util.Abort( |
|
764 | raise util.Abort( | |
753 |
|
|
765 | _("cannot push to a previous patch: %s") % patch) | |
754 | if info[0] < len(self.series) - 1: |
|
766 | if info[0] < len(self.series) - 1: | |
755 | self.ui.warn(_('qpush: %s is already at the top\n') % patch) |
|
767 | self.ui.warn( | |
|
768 | _('qpush: %s is already at the top\n') % patch) | |||
756 | else: |
|
769 | else: | |
757 | self.ui.warn(_('all patches are currently applied\n')) |
|
770 | self.ui.warn(_('all patches are currently applied\n')) | |
758 | return |
|
771 | return | |
759 |
|
772 | |||
760 | # Following the above example, starting at 'top' of B: |
|
773 | # Following the above example, starting at 'top' of B: | |
761 |
|
|
774 | # qpush should be performed (pushes C), but a subsequent | |
762 |
# an argument is an error (nothing to |
|
775 | # qpush without an argument is an error (nothing to | |
763 | # of "...while hg qpush..." to work as it detects an error when done |
|
776 | # apply). This allows a loop of "...while hg qpush..." to | |
|
777 | # work as it detects an error when done | |||
764 | if self.series_end() == len(self.series): |
|
778 | if self.series_end() == len(self.series): | |
765 | self.ui.warn(_('patch series already fully applied\n')) |
|
779 | self.ui.warn(_('patch series already fully applied\n')) | |
766 | return 1 |
|
780 | return 1 | |
@@ -798,11 +812,13 b' class queue:' | |||||
798 | raise |
|
812 | raise | |
799 | top = self.applied[-1].name |
|
813 | top = self.applied[-1].name | |
800 | if ret[0]: |
|
814 | if ret[0]: | |
801 | self.ui.write("Errors during apply, please fix and refresh %s\n" % |
|
815 | self.ui.write( | |
802 | top) |
|
816 | "Errors during apply, please fix and refresh %s\n" % top) | |
803 | else: |
|
817 | else: | |
804 | self.ui.write("Now at: %s\n" % top) |
|
818 | self.ui.write("Now at: %s\n" % top) | |
805 | return ret[0] |
|
819 | return ret[0] | |
|
820 | finally: | |||
|
821 | del wlock | |||
806 |
|
822 | |||
807 | def pop(self, repo, patch=None, force=False, update=True, all=False, |
|
823 | def pop(self, repo, patch=None, force=False, update=True, all=False, | |
808 | wlock=None): |
|
824 | wlock=None): | |
@@ -812,6 +828,7 b' class queue:' | |||||
812 |
|
828 | |||
813 | if not wlock: |
|
829 | if not wlock: | |
814 | wlock = repo.wlock() |
|
830 | wlock = repo.wlock() | |
|
831 | try: | |||
815 | if patch: |
|
832 | if patch: | |
816 | # index, rev, patch |
|
833 | # index, rev, patch | |
817 | info = self.isapplied(patch) |
|
834 | info = self.isapplied(patch) | |
@@ -888,6 +905,8 b' class queue:' | |||||
888 | self.ui.write("Now at: %s\n" % self.applied[-1].name) |
|
905 | self.ui.write("Now at: %s\n" % self.applied[-1].name) | |
889 | else: |
|
906 | else: | |
890 | self.ui.write("Patch queue now empty\n") |
|
907 | self.ui.write("Patch queue now empty\n") | |
|
908 | finally: | |||
|
909 | del wlock | |||
891 |
|
910 | |||
892 | def diff(self, repo, pats, opts): |
|
911 | def diff(self, repo, pats, opts): | |
893 | top = self.check_toppatch(repo) |
|
912 | top = self.check_toppatch(repo) | |
@@ -904,6 +923,7 b' class queue:' | |||||
904 | self.ui.write("No patches applied\n") |
|
923 | self.ui.write("No patches applied\n") | |
905 | return 1 |
|
924 | return 1 | |
906 | wlock = repo.wlock() |
|
925 | wlock = repo.wlock() | |
|
926 | try: | |||
907 | self.check_toppatch(repo) |
|
927 | self.check_toppatch(repo) | |
908 | (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) |
|
928 | (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) | |
909 | top = revlog.bin(top) |
|
929 | top = revlog.bin(top) | |
@@ -969,9 +989,10 b' class queue:' | |||||
969 | match = util.always |
|
989 | match = util.always | |
970 | m, a, r, d, u = repo.status(files=filelist, match=match)[:5] |
|
990 | m, a, r, d, u = repo.status(files=filelist, match=match)[:5] | |
971 |
|
991 | |||
972 |
# we might end up with files that were added between |
|
992 | # we might end up with files that were added between | |
973 |
# the dirstate parent, but then changed in the |
|
993 | # tip and the dirstate parent, but then changed in the | |
974 |
# in this case, we want them to only |
|
994 | # local dirstate. in this case, we want them to only | |
|
995 | # show up in the added section | |||
975 | for x in m: |
|
996 | for x in m: | |
976 | if x not in aa: |
|
997 | if x not in aa: | |
977 | mm.append(x) |
|
998 | mm.append(x) | |
@@ -1031,8 +1052,8 b' class queue:' | |||||
1031 | repo.dirstate.copy(src, dst) |
|
1052 | repo.dirstate.copy(src, dst) | |
1032 | for f in r: |
|
1053 | for f in r: | |
1033 | repo.dirstate.remove(f) |
|
1054 | repo.dirstate.remove(f) | |
1034 |
# if the patch excludes a modified file, mark that |
|
1055 | # if the patch excludes a modified file, mark that | |
1035 | # so status can see it. |
|
1056 | # file with mtime=0 so status can see it. | |
1036 | mm = [] |
|
1057 | mm = [] | |
1037 | for i in xrange(len(m)-1, -1, -1): |
|
1058 | for i in xrange(len(m)-1, -1, -1): | |
1038 | if not matchfn(m[i]): |
|
1059 | if not matchfn(m[i]): | |
@@ -1053,7 +1074,8 b' class queue:' | |||||
1053 | else: |
|
1074 | else: | |
1054 | message = msg |
|
1075 | message = msg | |
1055 |
|
1076 | |||
1056 |
self.strip(repo, top, update=False, |
|
1077 | self.strip(repo, top, update=False, | |
|
1078 | backup='strip', wlock=wlock) | |||
1057 | n = repo.commit(filelist, message, changes[1], match=matchfn, |
|
1079 | n = repo.commit(filelist, message, changes[1], match=matchfn, | |
1058 | force=1, wlock=wlock) |
|
1080 | force=1, wlock=wlock) | |
1059 | self.applied[-1] = statusentry(revlog.hex(n), patchfn) |
|
1081 | self.applied[-1] = statusentry(revlog.hex(n), patchfn) | |
@@ -1077,6 +1099,8 b' class queue:' | |||||
1077 | repo.dirstate.forget(a) |
|
1099 | repo.dirstate.forget(a) | |
1078 | self.pop(repo, force=True, wlock=wlock) |
|
1100 | self.pop(repo, force=True, wlock=wlock) | |
1079 | self.push(repo, force=True, wlock=wlock) |
|
1101 | self.push(repo, force=True, wlock=wlock) | |
|
1102 | finally: | |||
|
1103 | del wlock | |||
1080 |
|
1104 | |||
1081 | def init(self, repo, create=False): |
|
1105 | def init(self, repo, create=False): | |
1082 | if not create and os.path.isdir(self.path): |
|
1106 | if not create and os.path.isdir(self.path): | |
@@ -1872,10 +1896,13 b' def rename(ui, repo, patch, name=None, *' | |||||
1872 | r = q.qrepo() |
|
1896 | r = q.qrepo() | |
1873 | if r: |
|
1897 | if r: | |
1874 | wlock = r.wlock() |
|
1898 | wlock = r.wlock() | |
|
1899 | try: | |||
1875 | if r.dirstate[name] == 'r': |
|
1900 | if r.dirstate[name] == 'r': | |
1876 | r.undelete([name], wlock) |
|
1901 | r.undelete([name], wlock) | |
1877 | r.copy(patch, name, wlock) |
|
1902 | r.copy(patch, name, wlock) | |
1878 | r.remove([patch], False, wlock) |
|
1903 | r.remove([patch], False, wlock) | |
|
1904 | finally: | |||
|
1905 | del wlock | |||
1879 |
|
1906 | |||
1880 | q.save_dirty() |
|
1907 | q.save_dirty() | |
1881 |
|
1908 |
@@ -96,9 +96,10 b' class transplanter:' | |||||
96 | diffopts = patch.diffopts(self.ui, opts) |
|
96 | diffopts = patch.diffopts(self.ui, opts) | |
97 | diffopts.git = True |
|
97 | diffopts.git = True | |
98 |
|
98 | |||
|
99 | lock = wlock = None | |||
|
100 | try: | |||
99 | wlock = repo.wlock() |
|
101 | wlock = repo.wlock() | |
100 | lock = repo.lock() |
|
102 | lock = repo.lock() | |
101 | try: |
|
|||
102 | for rev in revs: |
|
103 | for rev in revs: | |
103 | node = revmap[rev] |
|
104 | node = revmap[rev] | |
104 | revstr = '%s:%s' % (rev, revlog.short(node)) |
|
105 | revstr = '%s:%s' % (rev, revlog.short(node)) | |
@@ -166,6 +167,7 b' class transplanter:' | |||||
166 | finally: |
|
167 | finally: | |
167 | self.saveseries(revmap, merges) |
|
168 | self.saveseries(revmap, merges) | |
168 | self.transplants.write() |
|
169 | self.transplants.write() | |
|
170 | del lock, wlock | |||
169 |
|
171 | |||
170 | def filter(self, filter, changelog, patchfile): |
|
172 | def filter(self, filter, changelog, patchfile): | |
171 | '''arbitrarily rewrite changeset before applying it''' |
|
173 | '''arbitrarily rewrite changeset before applying it''' | |
@@ -272,13 +274,16 b' class transplanter:' | |||||
272 |
|
274 | |||
273 | extra = {'transplant_source': node} |
|
275 | extra = {'transplant_source': node} | |
274 | wlock = repo.wlock() |
|
276 | wlock = repo.wlock() | |
|
277 | try: | |||
275 | p1, p2 = repo.dirstate.parents() |
|
278 | p1, p2 = repo.dirstate.parents() | |
276 | if p1 != parents[0]: |
|
279 | if p1 != parents[0]: | |
277 | raise util.Abort(_('working dir not at transplant parent %s') % |
|
280 | raise util.Abort( | |
|
281 | _('working dir not at transplant parent %s') % | |||
278 | revlog.hex(parents[0])) |
|
282 | revlog.hex(parents[0])) | |
279 | if merge: |
|
283 | if merge: | |
280 | repo.dirstate.setparents(p1, parents[1]) |
|
284 | repo.dirstate.setparents(p1, parents[1]) | |
281 |
n = repo.commit(None, message, user, date, wlock=wlock, |
|
285 | n = repo.commit(None, message, user, date, wlock=wlock, | |
|
286 | extra=extra) | |||
282 | if not n: |
|
287 | if not n: | |
283 | raise util.Abort(_('commit failed')) |
|
288 | raise util.Abort(_('commit failed')) | |
284 | if not merge: |
|
289 | if not merge: | |
@@ -286,6 +291,8 b' class transplanter:' | |||||
286 | self.unlog() |
|
291 | self.unlog() | |
287 |
|
292 | |||
288 | return n, node |
|
293 | return n, node | |
|
294 | finally: | |||
|
295 | del wlock | |||
289 |
|
296 | |||
290 | def readseries(self): |
|
297 | def readseries(self): | |
291 | nodes = [] |
|
298 | nodes = [] |
@@ -676,7 +676,10 b' def copy(ui, repo, *pats, **opts):' | |||||
676 | before that, see hg revert. |
|
676 | before that, see hg revert. | |
677 | """ |
|
677 | """ | |
678 | wlock = repo.wlock(False) |
|
678 | wlock = repo.wlock(False) | |
|
679 | try: | |||
679 | errs, copied = docopy(ui, repo, pats, opts, wlock) |
|
680 | errs, copied = docopy(ui, repo, pats, opts, wlock) | |
|
681 | finally: | |||
|
682 | del wlock | |||
680 | return errs |
|
683 | return errs | |
681 |
|
684 | |||
682 | def debugancestor(ui, index, rev1, rev2): |
|
685 | def debugancestor(ui, index, rev1, rev2): | |
@@ -713,7 +716,10 b' def debugrebuildstate(ui, repo, rev=""):' | |||||
713 | ctx = repo.changectx(rev) |
|
716 | ctx = repo.changectx(rev) | |
714 | files = ctx.manifest() |
|
717 | files = ctx.manifest() | |
715 | wlock = repo.wlock() |
|
718 | wlock = repo.wlock() | |
|
719 | try: | |||
716 | repo.dirstate.rebuild(rev, files) |
|
720 | repo.dirstate.rebuild(rev, files) | |
|
721 | finally: | |||
|
722 | del wlock | |||
717 |
|
723 | |||
718 | def debugcheckstate(ui, repo): |
|
724 | def debugcheckstate(ui, repo): | |
719 | """validate the correctness of the current dirstate""" |
|
725 | """validate the correctness of the current dirstate""" | |
@@ -782,7 +788,7 b' def debugsetparents(ui, repo, rev1, rev2' | |||||
782 | try: |
|
788 | try: | |
783 | repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2)) |
|
789 | repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2)) | |
784 | finally: |
|
790 | finally: | |
785 |
wlock |
|
791 | del wlock | |
786 |
|
792 | |||
787 | def debugstate(ui, repo): |
|
793 | def debugstate(ui, repo): | |
788 | """show the contents of the current dirstate""" |
|
794 | """show the contents of the current dirstate""" | |
@@ -1581,19 +1587,21 b' def import_(ui, repo, patch1, *patches, ' | |||||
1581 |
|
1587 | |||
1582 | d = opts["base"] |
|
1588 | d = opts["base"] | |
1583 | strip = opts["strip"] |
|
1589 | strip = opts["strip"] | |
1584 |
|
1590 | wlock = lock = None | ||
|
1591 | try: | |||
1585 | wlock = repo.wlock() |
|
1592 | wlock = repo.wlock() | |
1586 | lock = repo.lock() |
|
1593 | lock = repo.lock() | |
1587 |
|
||||
1588 | for p in patches: |
|
1594 | for p in patches: | |
1589 | pf = os.path.join(d, p) |
|
1595 | pf = os.path.join(d, p) | |
1590 |
|
1596 | |||
1591 | if pf == '-': |
|
1597 | if pf == '-': | |
1592 | ui.status(_("applying patch from stdin\n")) |
|
1598 | ui.status(_("applying patch from stdin\n")) | |
1593 |
|
|
1599 | data = patch.extract(ui, sys.stdin) | |
1594 | else: |
|
1600 | else: | |
1595 | ui.status(_("applying %s\n") % p) |
|
1601 | ui.status(_("applying %s\n") % p) | |
1596 |
|
|
1602 | data = patch.extract(ui, file(pf, 'rb')) | |
|
1603 | ||||
|
1604 | tmpname, message, user, date, branch, nodeid, p1, p2 = data | |||
1597 |
|
1605 | |||
1598 | if tmpname is None: |
|
1606 | if tmpname is None: | |
1599 | raise util.Abort(_('no diffs found')) |
|
1607 | raise util.Abort(_('no diffs found')) | |
@@ -1638,13 +1646,17 b' def import_(ui, repo, patch1, *patches, ' | |||||
1638 | files=files) |
|
1646 | files=files) | |
1639 | finally: |
|
1647 | finally: | |
1640 | files = patch.updatedir(ui, repo, files, wlock=wlock) |
|
1648 | files = patch.updatedir(ui, repo, files, wlock=wlock) | |
1641 |
n = repo.commit(files, message, user, date, wlock=wlock, |
|
1649 | n = repo.commit(files, message, user, date, wlock=wlock, | |
|
1650 | lock=lock) | |||
1642 | if opts.get('exact'): |
|
1651 | if opts.get('exact'): | |
1643 | if hex(n) != nodeid: |
|
1652 | if hex(n) != nodeid: | |
1644 | repo.rollback(wlock=wlock, lock=lock) |
|
1653 | repo.rollback(wlock=wlock, lock=lock) | |
1645 |
raise util.Abort(_('patch is damaged |
|
1654 | raise util.Abort(_('patch is damaged' + | |
|
1655 | ' or loses information')) | |||
1646 | finally: |
|
1656 | finally: | |
1647 | os.unlink(tmpname) |
|
1657 | os.unlink(tmpname) | |
|
1658 | finally: | |||
|
1659 | del wlock, lock | |||
1648 |
|
1660 | |||
1649 | def incoming(ui, repo, source="default", **opts): |
|
1661 | def incoming(ui, repo, source="default", **opts): | |
1650 | """show new changesets found in source |
|
1662 | """show new changesets found in source | |
@@ -2248,6 +2260,7 b' def rename(ui, repo, *pats, **opts):' | |||||
2248 | before that, see hg revert. |
|
2260 | before that, see hg revert. | |
2249 | """ |
|
2261 | """ | |
2250 | wlock = repo.wlock(False) |
|
2262 | wlock = repo.wlock(False) | |
|
2263 | try: | |||
2251 | errs, copied = docopy(ui, repo, pats, opts, wlock) |
|
2264 | errs, copied = docopy(ui, repo, pats, opts, wlock) | |
2252 | names = [] |
|
2265 | names = [] | |
2253 | for abs, rel, exact in copied: |
|
2266 | for abs, rel, exact in copied: | |
@@ -2257,6 +2270,8 b' def rename(ui, repo, *pats, **opts):' | |||||
2257 | if not opts.get('dry_run'): |
|
2270 | if not opts.get('dry_run'): | |
2258 | repo.remove(names, True, wlock=wlock) |
|
2271 | repo.remove(names, True, wlock=wlock) | |
2259 | return errs |
|
2272 | return errs | |
|
2273 | finally: | |||
|
2274 | del wlock | |||
2260 |
|
2275 | |||
2261 | def revert(ui, repo, *pats, **opts): |
|
2276 | def revert(ui, repo, *pats, **opts): | |
2262 | """revert files or dirs to their states as of some revision |
|
2277 | """revert files or dirs to their states as of some revision | |
@@ -2310,8 +2325,6 b' def revert(ui, repo, *pats, **opts):' | |||||
2310 | else: |
|
2325 | else: | |
2311 | pmf = None |
|
2326 | pmf = None | |
2312 |
|
2327 | |||
2313 | wlock = repo.wlock() |
|
|||
2314 |
|
||||
2315 | # need all matching names in dirstate and manifest of target rev, |
|
2328 | # need all matching names in dirstate and manifest of target rev, | |
2316 | # so have to walk both. do not print errors if files exist in one |
|
2329 | # so have to walk both. do not print errors if files exist in one | |
2317 | # but not other. |
|
2330 | # but not other. | |
@@ -2319,8 +2332,9 b' def revert(ui, repo, *pats, **opts):' | |||||
2319 | names = {} |
|
2332 | names = {} | |
2320 | target_only = {} |
|
2333 | target_only = {} | |
2321 |
|
2334 | |||
|
2335 | wlock = repo.wlock() | |||
|
2336 | try: | |||
2322 | # walk dirstate. |
|
2337 | # walk dirstate. | |
2323 |
|
||||
2324 | for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
|
2338 | for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, | |
2325 | badmatch=mf.has_key): |
|
2339 | badmatch=mf.has_key): | |
2326 | names[abs] = (rel, exact) |
|
2340 | names[abs] = (rel, exact) | |
@@ -2426,6 +2440,8 b' def revert(ui, repo, *pats, **opts):' | |||||
2426 | for f in remove[0]: |
|
2440 | for f in remove[0]: | |
2427 | repo.dirstate.remove(f) |
|
2441 | repo.dirstate.remove(f) | |
2428 | return r |
|
2442 | return r | |
|
2443 | finally: | |||
|
2444 | del wlock | |||
2429 |
|
2445 | |||
2430 | def rollback(ui, repo): |
|
2446 | def rollback(ui, repo): | |
2431 | """roll back the last transaction in this repository |
|
2447 | """roll back the last transaction in this repository |
@@ -130,7 +130,8 b' def clone(ui, source, dest=None, pull=Fa' | |||||
130 | if self.dir_: |
|
130 | if self.dir_: | |
131 | self.rmtree(self.dir_, True) |
|
131 | self.rmtree(self.dir_, True) | |
132 |
|
132 | |||
133 | dir_cleanup = None |
|
133 | src_lock = dest_lock = dir_cleanup = None | |
|
134 | try: | |||
134 | if islocal(dest): |
|
135 | if islocal(dest): | |
135 | dir_cleanup = DirCleanup(dest) |
|
136 | dir_cleanup = DirCleanup(dest) | |
136 |
|
137 | |||
@@ -140,7 +141,6 b' def clone(ui, source, dest=None, pull=Fa' | |||||
140 | abspath = os.path.abspath(origsource) |
|
141 | abspath = os.path.abspath(origsource) | |
141 | copy = not pull and not rev |
|
142 | copy = not pull and not rev | |
142 |
|
143 | |||
143 | src_lock, dest_lock = None, None |
|
|||
144 | if copy: |
|
144 | if copy: | |
145 | try: |
|
145 | try: | |
146 | # we use a lock here because if we race with commit, we |
|
146 | # we use a lock here because if we race with commit, we | |
@@ -205,18 +205,12 b' def clone(ui, source, dest=None, pull=Fa' | |||||
205 | else: |
|
205 | else: | |
206 | raise util.Abort(_("clone from remote to remote not supported")) |
|
206 | raise util.Abort(_("clone from remote to remote not supported")) | |
207 |
|
207 | |||
208 | if src_lock: |
|
|||
209 | src_lock.release() |
|
|||
210 |
|
||||
211 | if dest_repo.local(): |
|
208 | if dest_repo.local(): | |
212 | fp = dest_repo.opener("hgrc", "w", text=True) |
|
209 | fp = dest_repo.opener("hgrc", "w", text=True) | |
213 | fp.write("[paths]\n") |
|
210 | fp.write("[paths]\n") | |
214 | fp.write("default = %s\n" % abspath) |
|
211 | fp.write("default = %s\n" % abspath) | |
215 | fp.close() |
|
212 | fp.close() | |
216 |
|
213 | |||
217 | if dest_lock: |
|
|||
218 | dest_lock.release() |
|
|||
219 |
|
||||
220 | if update: |
|
214 | if update: | |
221 | try: |
|
215 | try: | |
222 | checkout = dest_repo.lookup("default") |
|
216 | checkout = dest_repo.lookup("default") | |
@@ -227,6 +221,8 b' def clone(ui, source, dest=None, pull=Fa' | |||||
227 | dir_cleanup.close() |
|
221 | dir_cleanup.close() | |
228 |
|
222 | |||
229 | return src_repo, dest_repo |
|
223 | return src_repo, dest_repo | |
|
224 | finally: | |||
|
225 | del src_lock, dest_lock, dir_cleanup | |||
230 |
|
226 | |||
231 | def _showstats(repo, stats): |
|
227 | def _showstats(repo, stats): | |
232 | stats = ((stats[0], _("updated")), |
|
228 | stats = ((stats[0], _("updated")), |
@@ -1168,7 +1168,7 b' class hgweb(object):' | |||||
1168 | req.write('%d\n' % ret) |
|
1168 | req.write('%d\n' % ret) | |
1169 | req.write(val) |
|
1169 | req.write(val) | |
1170 | finally: |
|
1170 | finally: | |
1171 |
lock |
|
1171 | del lock | |
1172 | except (OSError, IOError), inst: |
|
1172 | except (OSError, IOError), inst: | |
1173 | req.write('0\n') |
|
1173 | req.write('0\n') | |
1174 | filename = getattr(inst, 'filename', '') |
|
1174 | filename = getattr(inst, 'filename', '') |
@@ -516,6 +516,7 b' class localrepository(repo.repository):' | |||||
516 |
|
516 | |||
517 | def recover(self): |
|
517 | def recover(self): | |
518 | l = self.lock() |
|
518 | l = self.lock() | |
|
519 | try: | |||
519 | if os.path.exists(self.sjoin("journal")): |
|
520 | if os.path.exists(self.sjoin("journal")): | |
520 | self.ui.status(_("rolling back interrupted transaction\n")) |
|
521 | self.ui.status(_("rolling back interrupted transaction\n")) | |
521 | transaction.rollback(self.sopener, self.sjoin("journal")) |
|
522 | transaction.rollback(self.sopener, self.sjoin("journal")) | |
@@ -524,8 +525,11 b' class localrepository(repo.repository):' | |||||
524 | else: |
|
525 | else: | |
525 | self.ui.warn(_("no interrupted transaction available\n")) |
|
526 | self.ui.warn(_("no interrupted transaction available\n")) | |
526 | return False |
|
527 | return False | |
|
528 | finally: | |||
|
529 | del l | |||
527 |
|
530 | |||
528 | def rollback(self, wlock=None, lock=None): |
|
531 | def rollback(self, wlock=None, lock=None): | |
|
532 | try: | |||
529 | if not wlock: |
|
533 | if not wlock: | |
530 | wlock = self.wlock() |
|
534 | wlock = self.wlock() | |
531 | if not lock: |
|
535 | if not lock: | |
@@ -538,6 +542,8 b' class localrepository(repo.repository):' | |||||
538 | self.dirstate.invalidate() |
|
542 | self.dirstate.invalidate() | |
539 | else: |
|
543 | else: | |
540 | self.ui.warn(_("no rollback information available\n")) |
|
544 | self.ui.warn(_("no rollback information available\n")) | |
|
545 | finally: | |||
|
546 | del wlock, lock | |||
541 |
|
547 | |||
542 | def invalidate(self): |
|
548 | def invalidate(self): | |
543 | for a in "changelog manifest".split(): |
|
549 | for a in "changelog manifest".split(): | |
@@ -639,7 +645,8 b' class localrepository(repo.repository):' | |||||
639 | def commit(self, files=None, text="", user=None, date=None, |
|
645 | def commit(self, files=None, text="", user=None, date=None, | |
640 | match=util.always, force=False, lock=None, wlock=None, |
|
646 | match=util.always, force=False, lock=None, wlock=None, | |
641 | force_editor=False, p1=None, p2=None, extra={}): |
|
647 | force_editor=False, p1=None, p2=None, extra={}): | |
642 |
|
648 | tr = None | ||
|
649 | try: | |||
643 | commit = [] |
|
650 | commit = [] | |
644 | remove = [] |
|
651 | remove = [] | |
645 | changed = [] |
|
652 | changed = [] | |
@@ -717,8 +724,9 b' class localrepository(repo.repository):' | |||||
717 | new_exec = is_exec(f) |
|
724 | new_exec = is_exec(f) | |
718 | new_link = is_link(f) |
|
725 | new_link = is_link(f) | |
719 | if not changed or changed[-1] != f: |
|
726 | if not changed or changed[-1] != f: | |
720 |
# mention the file in the changelog if some |
|
727 | # mention the file in the changelog if some | |
721 |
# even if there was no content |
|
728 | # flag changed, even if there was no content | |
|
729 | # change. | |||
722 | old_exec = m1.execf(f) |
|
730 | old_exec = m1.execf(f) | |
723 | old_link = m1.linkf(f) |
|
731 | old_link = m1.linkf(f) | |
724 | if old_exec != new_exec or old_link != new_link: |
|
732 | if old_exec != new_exec or old_link != new_link: | |
@@ -742,7 +750,8 b' class localrepository(repo.repository):' | |||||
742 | removed.append(f) |
|
750 | removed.append(f) | |
743 | elif f in m2: |
|
751 | elif f in m2: | |
744 | removed.append(f) |
|
752 | removed.append(f) | |
745 |
mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0], |
|
753 | mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0], | |
|
754 | (new, removed)) | |||
746 |
|
755 | |||
747 | # add changeset |
|
756 | # add changeset | |
748 | new = new.keys() |
|
757 | new = new.keys() | |
@@ -797,6 +806,8 b' class localrepository(repo.repository):' | |||||
797 |
|
806 | |||
798 | self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) |
|
807 | self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) | |
799 | return n |
|
808 | return n | |
|
809 | finally: | |||
|
810 | del lock, wlock, tr | |||
800 |
|
811 | |||
801 | def walk(self, node=None, files=[], match=util.always, badmatch=None): |
|
812 | def walk(self, node=None, files=[], match=util.always, badmatch=None): | |
802 | ''' |
|
813 | ''' | |
@@ -895,18 +906,18 b' class localrepository(repo.repository):' | |||||
895 |
|
906 | |||
896 | # update dirstate for files that are actually clean |
|
907 | # update dirstate for files that are actually clean | |
897 | if fixup: |
|
908 | if fixup: | |
898 |
|
|
909 | fixlock = wlock | |
899 | if not wlock: |
|
|||
900 |
|
|
910 | try: | |
901 |
|
|
911 | if not fixlock: | |
902 |
|
|
912 | try: | |
|
913 | fixlock = self.wlock(False) | |||
903 | except lock.LockException: |
|
914 | except lock.LockException: | |
904 | pass |
|
915 | pass | |
905 |
if |
|
916 | if fixlock: | |
906 | for f in fixup: |
|
917 | for f in fixup: | |
907 | self.dirstate.normal(f) |
|
918 | self.dirstate.normal(f) | |
908 |
|
|
919 | finally: | |
909 |
|
|
920 | del fixlock | |
910 | else: |
|
921 | else: | |
911 | # we are comparing working dir against non-parent |
|
922 | # we are comparing working dir against non-parent | |
912 | # generate a pseudo-manifest for the working dir |
|
923 | # generate a pseudo-manifest for the working dir | |
@@ -954,6 +965,7 b' class localrepository(repo.repository):' | |||||
954 | return (modified, added, removed, deleted, unknown, ignored, clean) |
|
965 | return (modified, added, removed, deleted, unknown, ignored, clean) | |
955 |
|
966 | |||
956 | def add(self, list, wlock=None): |
|
967 | def add(self, list, wlock=None): | |
|
968 | try: | |||
957 | if not wlock: |
|
969 | if not wlock: | |
958 | wlock = self.wlock() |
|
970 | wlock = self.wlock() | |
959 | for f in list: |
|
971 | for f in list: | |
@@ -975,8 +987,11 b' class localrepository(repo.repository):' | |||||
975 | self.ui.warn(_("%s already tracked!\n") % f) |
|
987 | self.ui.warn(_("%s already tracked!\n") % f) | |
976 | else: |
|
988 | else: | |
977 | self.dirstate.add(f) |
|
989 | self.dirstate.add(f) | |
|
990 | finally: | |||
|
991 | del wlock | |||
978 |
|
992 | |||
979 | def forget(self, list, wlock=None): |
|
993 | def forget(self, list, wlock=None): | |
|
994 | try: | |||
980 | if not wlock: |
|
995 | if not wlock: | |
981 | wlock = self.wlock() |
|
996 | wlock = self.wlock() | |
982 | for f in list: |
|
997 | for f in list: | |
@@ -984,8 +999,11 b' class localrepository(repo.repository):' | |||||
984 | self.ui.warn(_("%s not added!\n") % f) |
|
999 | self.ui.warn(_("%s not added!\n") % f) | |
985 | else: |
|
1000 | else: | |
986 | self.dirstate.forget(f) |
|
1001 | self.dirstate.forget(f) | |
|
1002 | finally: | |||
|
1003 | del wlock | |||
987 |
|
1004 | |||
988 | def remove(self, list, unlink=False, wlock=None): |
|
1005 | def remove(self, list, unlink=False, wlock=None): | |
|
1006 | try: | |||
989 | if unlink: |
|
1007 | if unlink: | |
990 | for f in list: |
|
1008 | for f in list: | |
991 | try: |
|
1009 | try: | |
@@ -1004,8 +1022,11 b' class localrepository(repo.repository):' | |||||
1004 | self.ui.warn(_("%s not tracked!\n") % f) |
|
1022 | self.ui.warn(_("%s not tracked!\n") % f) | |
1005 | else: |
|
1023 | else: | |
1006 | self.dirstate.remove(f) |
|
1024 | self.dirstate.remove(f) | |
|
1025 | finally: | |||
|
1026 | del wlock | |||
1007 |
|
1027 | |||
1008 | def undelete(self, list, wlock=None): |
|
1028 | def undelete(self, list, wlock=None): | |
|
1029 | try: | |||
1009 | p = self.dirstate.parents()[0] |
|
1030 | p = self.dirstate.parents()[0] | |
1010 | mn = self.changelog.read(p)[0] |
|
1031 | mn = self.changelog.read(p)[0] | |
1011 | m = self.manifest.read(mn) |
|
1032 | m = self.manifest.read(mn) | |
@@ -1018,8 +1039,11 b' class localrepository(repo.repository):' | |||||
1018 | t = self.file(f).read(m[f]) |
|
1039 | t = self.file(f).read(m[f]) | |
1019 | self.wwrite(f, t, m.flags(f)) |
|
1040 | self.wwrite(f, t, m.flags(f)) | |
1020 | self.dirstate.normal(f) |
|
1041 | self.dirstate.normal(f) | |
|
1042 | finally: | |||
|
1043 | del wlock | |||
1021 |
|
1044 | |||
1022 | def copy(self, source, dest, wlock=None): |
|
1045 | def copy(self, source, dest, wlock=None): | |
|
1046 | try: | |||
1023 | p = self.wjoin(dest) |
|
1047 | p = self.wjoin(dest) | |
1024 | if not (os.path.exists(p) or os.path.islink(p)): |
|
1048 | if not (os.path.exists(p) or os.path.islink(p)): | |
1025 | self.ui.warn(_("%s does not exist!\n") % dest) |
|
1049 | self.ui.warn(_("%s does not exist!\n") % dest) | |
@@ -1032,6 +1056,8 b' class localrepository(repo.repository):' | |||||
1032 | if dest not in self.dirstate: |
|
1056 | if dest not in self.dirstate: | |
1033 | self.dirstate.add(dest) |
|
1057 | self.dirstate.add(dest) | |
1034 | self.dirstate.copy(source, dest) |
|
1058 | self.dirstate.copy(source, dest) | |
|
1059 | finally: | |||
|
1060 | del wlock | |||
1035 |
|
1061 | |||
1036 | def heads(self, start=None): |
|
1062 | def heads(self, start=None): | |
1037 | heads = self.changelog.heads(start) |
|
1063 | heads = self.changelog.heads(start) | |
@@ -1309,12 +1335,9 b' class localrepository(repo.repository):' | |||||
1309 | return subset |
|
1335 | return subset | |
1310 |
|
1336 | |||
1311 | def pull(self, remote, heads=None, force=False, lock=None): |
|
1337 | def pull(self, remote, heads=None, force=False, lock=None): | |
1312 | mylock = False |
|
1338 | try: | |
1313 | if not lock: |
|
1339 | if not lock: | |
1314 | lock = self.lock() |
|
1340 | lock = self.lock() | |
1315 | mylock = True |
|
|||
1316 |
|
||||
1317 | try: |
|
|||
1318 | fetch = self.findincoming(remote, force=force) |
|
1341 | fetch = self.findincoming(remote, force=force) | |
1319 | if fetch == [nullid]: |
|
1342 | if fetch == [nullid]: | |
1320 | self.ui.status(_("requesting all changes\n")) |
|
1343 | self.ui.status(_("requesting all changes\n")) | |
@@ -1331,8 +1354,7 b' class localrepository(repo.repository):' | |||||
1331 | cg = remote.changegroupsubset(fetch, heads, 'pull') |
|
1354 | cg = remote.changegroupsubset(fetch, heads, 'pull') | |
1332 | return self.addchangegroup(cg, 'pull', remote.url()) |
|
1355 | return self.addchangegroup(cg, 'pull', remote.url()) | |
1333 | finally: |
|
1356 | finally: | |
1334 |
|
|
1357 | del lock | |
1335 | lock.release() |
|
|||
1336 |
|
1358 | |||
1337 | def push(self, remote, force=False, revs=None): |
|
1359 | def push(self, remote, force=False, revs=None): | |
1338 | # there are two ways to push to remote repo: |
|
1360 | # there are two ways to push to remote repo: | |
@@ -1405,12 +1427,14 b' class localrepository(repo.repository):' | |||||
1405 |
|
1427 | |||
1406 | def push_addchangegroup(self, remote, force, revs): |
|
1428 | def push_addchangegroup(self, remote, force, revs): | |
1407 | lock = remote.lock() |
|
1429 | lock = remote.lock() | |
1408 |
|
1430 | try: | ||
1409 | ret = self.prepush(remote, force, revs) |
|
1431 | ret = self.prepush(remote, force, revs) | |
1410 | if ret[0] is not None: |
|
1432 | if ret[0] is not None: | |
1411 | cg, remote_heads = ret |
|
1433 | cg, remote_heads = ret | |
1412 | return remote.addchangegroup(cg, 'push', self.url()) |
|
1434 | return remote.addchangegroup(cg, 'push', self.url()) | |
1413 | return ret[1] |
|
1435 | return ret[1] | |
|
1436 | finally: | |||
|
1437 | del lock | |||
1414 |
|
1438 | |||
1415 | def push_unbundle(self, remote, force, revs): |
|
1439 | def push_unbundle(self, remote, force, revs): | |
1416 | # local repo finds heads on server, finds out what revs it |
|
1440 | # local repo finds heads on server, finds out what revs it | |
@@ -1794,14 +1818,14 b' class localrepository(repo.repository):' | |||||
1794 |
|
1818 | |||
1795 | changesets = files = revisions = 0 |
|
1819 | changesets = files = revisions = 0 | |
1796 |
|
1820 | |||
1797 | tr = self.transaction() |
|
|||
1798 |
|
||||
1799 | # write changelog data to temp files so concurrent readers will not see |
|
1821 | # write changelog data to temp files so concurrent readers will not see | |
1800 | # inconsistent view |
|
1822 | # inconsistent view | |
1801 | cl = self.changelog |
|
1823 | cl = self.changelog | |
1802 | cl.delayupdate() |
|
1824 | cl.delayupdate() | |
1803 | oldheads = len(cl.heads()) |
|
1825 | oldheads = len(cl.heads()) | |
1804 |
|
1826 | |||
|
1827 | tr = self.transaction() | |||
|
1828 | try: | |||
1805 | # pull off the changeset group |
|
1829 | # pull off the changeset group | |
1806 | self.ui.status(_("adding changesets\n")) |
|
1830 | self.ui.status(_("adding changesets\n")) | |
1807 | cor = cl.count() - 1 |
|
1831 | cor = cl.count() - 1 | |
@@ -1853,6 +1877,8 b' class localrepository(repo.repository):' | |||||
1853 | url=url) |
|
1877 | url=url) | |
1854 |
|
1878 | |||
1855 | tr.close() |
|
1879 | tr.close() | |
|
1880 | finally: | |||
|
1881 | del tr | |||
1856 |
|
1882 | |||
1857 | if changesets > 0: |
|
1883 | if changesets > 0: | |
1858 | self.hook("changegroup", node=hex(self.changelog.node(cor+1)), |
|
1884 | self.hook("changegroup", node=hex(self.changelog.node(cor+1)), |
@@ -506,6 +506,7 b' def update(repo, node, branchmerge, forc' | |||||
506 | wlock = working dir lock, if already held |
|
506 | wlock = working dir lock, if already held | |
507 | """ |
|
507 | """ | |
508 |
|
508 | |||
|
509 | try: | |||
509 | if not wlock: |
|
510 | if not wlock: | |
510 | wlock = repo.wlock() |
|
511 | wlock = repo.wlock() | |
511 |
|
512 | |||
@@ -567,4 +568,5 b' def update(repo, node, branchmerge, forc' | |||||
567 | repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) |
|
568 | repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) | |
568 |
|
569 | |||
569 | return stats |
|
570 | return stats | |
570 |
|
571 | finally: | ||
|
572 | del wlock |
@@ -66,6 +66,8 b' def stream_out(repo, fileobj, untrusted=' | |||||
66 |
|
66 | |||
67 | # get consistent snapshot of repo. lock during scan so lock not |
|
67 | # get consistent snapshot of repo. lock during scan so lock not | |
68 | # needed while we stream, and commits can happen. |
|
68 | # needed while we stream, and commits can happen. | |
|
69 | lock = None | |||
|
70 | try: | |||
69 | try: |
|
71 | try: | |
70 | repolock = repo.lock() |
|
72 | repolock = repo.lock() | |
71 | except (lock.LockHeld, lock.LockUnavailable), inst: |
|
73 | except (lock.LockHeld, lock.LockUnavailable), inst: | |
@@ -81,7 +83,8 b' def stream_out(repo, fileobj, untrusted=' | |||||
81 | name = repo.decodefn(util.pconvert(name)) |
|
83 | name = repo.decodefn(util.pconvert(name)) | |
82 | entries.append((name, size)) |
|
84 | entries.append((name, size)) | |
83 | total_bytes += size |
|
85 | total_bytes += size | |
84 | repolock.release() |
|
86 | finally: | |
|
87 | del repolock | |||
85 |
|
88 | |||
86 | repo.ui.debug('%d files, %d bytes to transfer\n' % |
|
89 | repo.ui.debug('%d files, %d bytes to transfer\n' % | |
87 | (len(entries), total_bytes)) |
|
90 | (len(entries), total_bytes)) |
@@ -10,6 +10,13 b' from i18n import _' | |||||
10 | import revlog, mdiff |
|
10 | import revlog, mdiff | |
11 |
|
11 | |||
12 | def verify(repo): |
|
12 | def verify(repo): | |
|
13 | lock = repo.lock() | |||
|
14 | try: | |||
|
15 | return _verify(repo) | |||
|
16 | finally: | |||
|
17 | del lock | |||
|
18 | ||||
|
19 | def _verify(repo): | |||
13 | filelinkrevs = {} |
|
20 | filelinkrevs = {} | |
14 | filenodes = {} |
|
21 | filenodes = {} | |
15 | changesets = revisions = files = 0 |
|
22 | changesets = revisions = files = 0 | |
@@ -17,8 +24,6 b' def verify(repo):' | |||||
17 | warnings = [0] |
|
24 | warnings = [0] | |
18 | neededmanifests = {} |
|
25 | neededmanifests = {} | |
19 |
|
26 | |||
20 | lock = repo.lock() |
|
|||
21 |
|
||||
22 | def err(msg): |
|
27 | def err(msg): | |
23 | repo.ui.warn(msg + "\n") |
|
28 | repo.ui.warn(msg + "\n") | |
24 | errors[0] += 1 |
|
29 | errors[0] += 1 |
General Comments 0
You need to be logged in to leave comments.
Login now