Show More
@@ -125,9 +125,10 b' class transplanter(object):' | |||||
125 | diffopts = patch.difffeatureopts(self.ui, opts) |
|
125 | diffopts = patch.difffeatureopts(self.ui, opts) | |
126 | diffopts.git = True |
|
126 | diffopts.git = True | |
127 |
|
127 | |||
128 | lock = wlock = tr = None |
|
128 | lock = wlock = tr = dsguard = None | |
129 | try: |
|
129 | try: | |
130 | wlock = repo.wlock() |
|
130 | wlock = repo.wlock() | |
|
131 | dsguard = cmdutil.dirstateguard(repo, 'transplant') | |||
131 | lock = repo.lock() |
|
132 | lock = repo.lock() | |
132 | tr = repo.transaction('transplant') |
|
133 | tr = repo.transaction('transplant') | |
133 | for rev in revs: |
|
134 | for rev in revs: | |
@@ -200,6 +201,7 b' class transplanter(object):' | |||||
200 | # Do not rollback, it is up to the user to |
|
201 | # Do not rollback, it is up to the user to | |
201 | # fix the merge or cancel everything |
|
202 | # fix the merge or cancel everything | |
202 | tr.close() |
|
203 | tr.close() | |
|
204 | dsguard.close() | |||
203 | raise |
|
205 | raise | |
204 | if n and domerge: |
|
206 | if n and domerge: | |
205 | self.ui.status(_('%s merged at %s\n') % (revstr, |
|
207 | self.ui.status(_('%s merged at %s\n') % (revstr, | |
@@ -212,6 +214,7 b' class transplanter(object):' | |||||
212 | if patchfile: |
|
214 | if patchfile: | |
213 | os.unlink(patchfile) |
|
215 | os.unlink(patchfile) | |
214 | tr.close() |
|
216 | tr.close() | |
|
217 | dsguard.close() | |||
215 | if pulls: |
|
218 | if pulls: | |
216 | exchange.pull(repo, source.peer(), heads=pulls) |
|
219 | exchange.pull(repo, source.peer(), heads=pulls) | |
217 | merge.update(repo, pulls[-1], False, False, None) |
|
220 | merge.update(repo, pulls[-1], False, False, None) | |
@@ -220,7 +223,10 b' class transplanter(object):' | |||||
220 | self.transplants.write() |
|
223 | self.transplants.write() | |
221 | if tr: |
|
224 | if tr: | |
222 | tr.release() |
|
225 | tr.release() | |
|
226 | if lock: | |||
223 | lock.release() |
|
227 | lock.release() | |
|
228 | if dsguard: | |||
|
229 | dsguard.release() | |||
224 | wlock.release() |
|
230 | wlock.release() | |
225 |
|
231 | |||
226 | def filter(self, filter, node, changelog, patchfile): |
|
232 | def filter(self, filter, node, changelog, patchfile): |
@@ -867,6 +867,7 b" timestamp of them isn't changed on the f" | |||||
867 | > [hooks] |
|
867 | > [hooks] | |
868 | > fakedirstatewritetime = ! |
|
868 | > fakedirstatewritetime = ! | |
869 | > fakepatchtime = ! |
|
869 | > fakepatchtime = ! | |
|
870 | > [extensions] | |||
870 | > abort = ! |
|
871 | > abort = ! | |
871 | > EOF |
|
872 | > EOF | |
872 |
|
873 | |||
@@ -877,4 +878,41 b" timestamp of them isn't changed on the f" | |||||
877 | $ hg status -A r1 |
|
878 | $ hg status -A r1 | |
878 | M r1 |
|
879 | M r1 | |
879 |
|
880 | |||
|
881 | Test that rollback by unexpected failure after transplanting the first | |||
|
882 | revision restores dirstate correctly. | |||
|
883 | ||||
|
884 | $ hg rollback -q | |||
|
885 | $ rm -f abort | |||
|
886 | $ hg update -q -C d11e3596cc1a | |||
|
887 | $ hg parents -T "{node|short}\n" | |||
|
888 | d11e3596cc1a | |||
|
889 | $ hg status -A | |||
|
890 | C r1 | |||
|
891 | C r2 | |||
|
892 | ||||
|
893 | $ cat >> .hg/hgrc <<EOF | |||
|
894 | > [hooks] | |||
|
895 | > # emulate failure at transplanting the 2nd revision | |||
|
896 | > pretxncommit.abort = test ! -f abort | |||
|
897 | > EOF | |||
|
898 | $ hg transplant "22c515968f13::" | |||
|
899 | applying 22c515968f13 | |||
|
900 | 22c515968f13 transplanted to * (glob) | |||
|
901 | applying e38700ba9dd3 | |||
|
902 | transaction abort! | |||
|
903 | rollback completed | |||
|
904 | abort: pretxncommit.abort hook exited with status 1 | |||
|
905 | [255] | |||
|
906 | $ cat >> .hg/hgrc <<EOF | |||
|
907 | > [hooks] | |||
|
908 | > pretxncommit.abort = ! | |||
|
909 | > EOF | |||
|
910 | ||||
|
911 | $ hg parents -T "{node|short}\n" | |||
|
912 | d11e3596cc1a | |||
|
913 | $ hg status -A | |||
|
914 | M r1 | |||
|
915 | ? abort | |||
|
916 | C r2 | |||
|
917 | ||||
880 | $ cd .. |
|
918 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now