Show More
@@ -3812,7 +3812,6 b' def import_(ui, repo, patch1=None, *patc' | |||||
3812 |
|
3812 | |||
3813 | def checkexact(repo, n, nodeid): |
|
3813 | def checkexact(repo, n, nodeid): | |
3814 | if opts.get('exact') and hex(n) != nodeid: |
|
3814 | if opts.get('exact') and hex(n) != nodeid: | |
3815 | repo.rollback() |
|
|||
3816 | raise util.Abort(_('patch is damaged or loses information')) |
|
3815 | raise util.Abort(_('patch is damaged or loses information')) | |
3817 |
|
3816 | |||
3818 | def tryone(ui, hunk, parents): |
|
3817 | def tryone(ui, hunk, parents): |
@@ -113,3 +113,41 b' Test with --bypass and --exact' | |||||
113 | $ hg strip --no-backup tip |
|
113 | $ hg strip --no-backup tip | |
114 |
|
114 | |||
115 | $ cd .. |
|
115 | $ cd .. | |
|
116 | ||||
|
117 | Test that --exact on a bad header doesn't corrupt the repo (issue3616) | |||
|
118 | ||||
|
119 | $ hg init repo3 | |||
|
120 | $ cd repo3 | |||
|
121 | $ echo a>a | |||
|
122 | $ hg ci -Aqm0 | |||
|
123 | $ echo a>>a | |||
|
124 | $ hg ci -m1 | |||
|
125 | $ echo a>>a | |||
|
126 | $ hg ci -m2 | |||
|
127 | $ echo a>a | |||
|
128 | $ echo b>>a | |||
|
129 | $ echo a>>a | |||
|
130 | $ hg ci -m3 | |||
|
131 | $ hg export 2 | head -7 > ../a.patch | |||
|
132 | $ hg export tip | tail -n +8 >> ../a.patch | |||
|
133 | ||||
|
134 | $ cd .. | |||
|
135 | $ hg clone -qr0 repo3 repo3-clone | |||
|
136 | $ cd repo3-clone | |||
|
137 | $ hg pull -qr1 ../repo3 | |||
|
138 | ||||
|
139 | $ hg import --exact ../a.patch | |||
|
140 | applying ../a.patch | |||
|
141 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
142 | patching file a | |||
|
143 | Hunk #1 succeeded at 1 with fuzz 1 (offset -1 lines). | |||
|
144 | transaction abort! | |||
|
145 | rollback completed | |||
|
146 | abort: patch is damaged or loses information | |||
|
147 | [255] | |||
|
148 | $ hg verify | |||
|
149 | checking changesets | |||
|
150 | checking manifests | |||
|
151 | crosschecking files in changesets and manifests | |||
|
152 | checking files | |||
|
153 | 1 files, 2 changesets, 2 total revisions |
General Comments 0
You need to be logged in to leave comments.
Login now