Show More
@@ -773,6 +773,14 b' class localrepository:' | |||||
773 | def wfile(self, f, mode='r'): |
|
773 | def wfile(self, f, mode='r'): | |
774 | return self.wopener(f, mode) |
|
774 | return self.wopener(f, mode) | |
775 |
|
775 | |||
|
776 | def wread(self, filename): | |||
|
777 | return self.wopener(filename, 'r').read() | |||
|
778 | ||||
|
779 | def wwrite(self, filename, data, fd=None): | |||
|
780 | if fd: | |||
|
781 | return fd.write(data) | |||
|
782 | return self.wopener(filename, 'w').write(data) | |||
|
783 | ||||
776 | def transaction(self): |
|
784 | def transaction(self): | |
777 | # save dirstate for undo |
|
785 | # save dirstate for undo | |
778 | try: |
|
786 | try: | |
@@ -839,7 +847,7 b' class localrepository:' | |||||
839 | linkrev = self.changelog.count() |
|
847 | linkrev = self.changelog.count() | |
840 | for f in files: |
|
848 | for f in files: | |
841 | try: |
|
849 | try: | |
842 |
t = self.w |
|
850 | t = self.wread(f) | |
843 | tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) |
|
851 | tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) | |
844 | r = self.file(f) |
|
852 | r = self.file(f) | |
845 | mfm[f] = tm |
|
853 | mfm[f] = tm | |
@@ -932,7 +940,7 b' class localrepository:' | |||||
932 | self.ui.note(f + "\n") |
|
940 | self.ui.note(f + "\n") | |
933 | try: |
|
941 | try: | |
934 | mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False)) |
|
942 | mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False)) | |
935 |
t = self.w |
|
943 | t = self.wread(f) | |
936 | except IOError: |
|
944 | except IOError: | |
937 | self.ui.warn("trouble committing %s!\n" % f) |
|
945 | self.ui.warn("trouble committing %s!\n" % f) | |
938 | raise |
|
946 | raise | |
@@ -1023,7 +1031,7 b' class localrepository:' | |||||
1023 | mf2, u = None, [] |
|
1031 | mf2, u = None, [] | |
1024 |
|
1032 | |||
1025 | def fcmp(fn, mf): |
|
1033 | def fcmp(fn, mf): | |
1026 |
t1 = self.w |
|
1034 | t1 = self.wread(fn) | |
1027 | t2 = self.file(fn).read(mf.get(fn, nullid)) |
|
1035 | t2 = self.file(fn).read(mf.get(fn, nullid)) | |
1028 | return cmp(t1, t2) |
|
1036 | return cmp(t1, t2) | |
1029 |
|
1037 | |||
@@ -1660,7 +1668,7 b' class localrepository:' | |||||
1660 |
|
1668 | |||
1661 | # is the wfile new since m1, and match m2? |
|
1669 | # is the wfile new since m1, and match m2? | |
1662 | if f not in m1: |
|
1670 | if f not in m1: | |
1663 |
t1 = self.w |
|
1671 | t1 = self.wread(f) | |
1664 | t2 = self.file(f).read(m2[f]) |
|
1672 | t2 = self.file(f).read(m2[f]) | |
1665 | if cmp(t1, t2) == 0: |
|
1673 | if cmp(t1, t2) == 0: | |
1666 | n = m2[f] |
|
1674 | n = m2[f] | |
@@ -1780,10 +1788,10 b' class localrepository:' | |||||
1780 | self.ui.note("getting %s\n" % f) |
|
1788 | self.ui.note("getting %s\n" % f) | |
1781 | t = self.file(f).read(get[f]) |
|
1789 | t = self.file(f).read(get[f]) | |
1782 | try: |
|
1790 | try: | |
1783 |
self.w |
|
1791 | self.wwrite(f, t) | |
1784 | except IOError: |
|
1792 | except IOError: | |
1785 | os.makedirs(os.path.dirname(self.wjoin(f))) |
|
1793 | os.makedirs(os.path.dirname(self.wjoin(f))) | |
1786 |
self.w |
|
1794 | self.wwrite(f, t) | |
1787 | util.set_exec(self.wjoin(f), mf2[f]) |
|
1795 | util.set_exec(self.wjoin(f), mf2[f]) | |
1788 | if moddirstate: |
|
1796 | if moddirstate: | |
1789 | if branch_merge: |
|
1797 | if branch_merge: | |
@@ -1836,7 +1844,7 b' class localrepository:' | |||||
1836 | pre = "%s~%s." % (os.path.basename(fn), prefix) |
|
1844 | pre = "%s~%s." % (os.path.basename(fn), prefix) | |
1837 | (fd, name) = tempfile.mkstemp("", pre) |
|
1845 | (fd, name) = tempfile.mkstemp("", pre) | |
1838 | f = os.fdopen(fd, "wb") |
|
1846 | f = os.fdopen(fd, "wb") | |
1839 | f.write(fl.read(node)) |
|
1847 | self.wwrite(fn, fl.read(node), f) | |
1840 | f.close() |
|
1848 | f.close() | |
1841 | return name |
|
1849 | return name | |
1842 |
|
1850 |
General Comments 0
You need to be logged in to leave comments.
Login now