Show More
@@ -1316,6 +1316,11 class committablectx(basectx): | |||||
1316 | self._repo.dirstate.setparents(node) |
|
1316 | self._repo.dirstate.setparents(node) | |
1317 | self._repo.dirstate.endparentchange() |
|
1317 | self._repo.dirstate.endparentchange() | |
1318 |
|
1318 | |||
|
1319 | # write changes out explicitly, because nesting wlock at | |||
|
1320 | # runtime may prevent 'wlock.release()' in 'repo.commit()' | |||
|
1321 | # from immediately doing so for subsequent changing files | |||
|
1322 | self._repo.dirstate.write() | |||
|
1323 | ||||
1319 | class workingctx(committablectx): |
|
1324 | class workingctx(committablectx): | |
1320 | """A workingctx object makes access to data related to |
|
1325 | """A workingctx object makes access to data related to | |
1321 | the current working directory convenient. |
|
1326 | the current working directory convenient. |
@@ -791,3 +791,90 Explicitly kill daemons to let the test | |||||
791 |
|
791 | |||
792 | $ killdaemons.py |
|
792 | $ killdaemons.py | |
793 |
|
793 | |||
|
794 | Test that patch-ed files are treated as "modified", when transplant is | |||
|
795 | aborted by failure of patching, even if none of mode, size and | |||
|
796 | timestamp of them isn't changed on the filesystem (see also issue4583) | |||
|
797 | ||||
|
798 | $ cd t | |||
|
799 | ||||
|
800 | $ cat > $TESTTMP/abort.py <<EOF | |||
|
801 | > # emulate that patch.patch() is aborted at patching on "abort" file | |||
|
802 | > from mercurial import extensions, patch as patchmod | |||
|
803 | > def patch(orig, ui, repo, patchname, | |||
|
804 | > strip=1, prefix='', files=None, | |||
|
805 | > eolmode='strict', similarity=0): | |||
|
806 | > if files is None: | |||
|
807 | > files = set() | |||
|
808 | > r = orig(ui, repo, patchname, | |||
|
809 | > strip=strip, prefix=prefix, files=files, | |||
|
810 | > eolmode=eolmode, similarity=similarity) | |||
|
811 | > if 'abort' in files: | |||
|
812 | > raise patchmod.PatchError('intentional error while patching') | |||
|
813 | > return r | |||
|
814 | > def extsetup(ui): | |||
|
815 | > extensions.wrapfunction(patchmod, 'patch', patch) | |||
|
816 | > EOF | |||
|
817 | ||||
|
818 | $ echo X1 > r1 | |||
|
819 | $ hg diff --nodates r1 | |||
|
820 | diff -r a53251cdf717 r1 | |||
|
821 | --- a/r1 | |||
|
822 | +++ b/r1 | |||
|
823 | @@ -1,1 +1,1 @@ | |||
|
824 | -r1 | |||
|
825 | +X1 | |||
|
826 | $ hg commit -m "X1 as r1" | |||
|
827 | ||||
|
828 | $ echo 'marking to abort patching' > abort | |||
|
829 | $ hg add abort | |||
|
830 | $ echo Y1 > r1 | |||
|
831 | $ hg diff --nodates r1 | |||
|
832 | diff -r 22c515968f13 r1 | |||
|
833 | --- a/r1 | |||
|
834 | +++ b/r1 | |||
|
835 | @@ -1,1 +1,1 @@ | |||
|
836 | -X1 | |||
|
837 | +Y1 | |||
|
838 | $ hg commit -m "Y1 as r1" | |||
|
839 | ||||
|
840 | $ hg update -q -C d11e3596cc1a | |||
|
841 | $ cat r1 | |||
|
842 | r1 | |||
|
843 | ||||
|
844 | $ cat >> .hg/hgrc <<EOF | |||
|
845 | > [fakedirstatewritetime] | |||
|
846 | > # emulate invoking dirstate.write() via repo.status() or markcommitted() | |||
|
847 | > # at 2000-01-01 00:00 | |||
|
848 | > fakenow = 200001010000 | |||
|
849 | > | |||
|
850 | > # emulate invoking patch.internalpatch() at 2000-01-01 00:00 | |||
|
851 | > [fakepatchtime] | |||
|
852 | > fakenow = 200001010000 | |||
|
853 | > | |||
|
854 | > [extensions] | |||
|
855 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |||
|
856 | > fakepatchtime = $TESTDIR/fakepatchtime.py | |||
|
857 | > abort = $TESTTMP/abort.py | |||
|
858 | > EOF | |||
|
859 | $ hg transplant "22c515968f13::" | |||
|
860 | applying 22c515968f13 | |||
|
861 | 22c515968f13 transplanted to * (glob) | |||
|
862 | applying e38700ba9dd3 | |||
|
863 | intentional error while patching | |||
|
864 | abort: fix up the merge and run hg transplant --continue | |||
|
865 | [255] | |||
|
866 | $ cat >> .hg/hgrc <<EOF | |||
|
867 | > [hooks] | |||
|
868 | > fakedirstatewritetime = ! | |||
|
869 | > fakepatchtime = ! | |||
|
870 | > abort = ! | |||
|
871 | > EOF | |||
|
872 | ||||
|
873 | $ cat r1 | |||
|
874 | Y1 | |||
|
875 | $ hg debugstate | grep ' r1$' | |||
|
876 | n 644 3 unset r1 | |||
|
877 | $ hg status -A r1 | |||
|
878 | M r1 | |||
|
879 | ||||
|
880 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now