Show More
@@ -2331,6 +2331,23 b' def reposetup(ui, repo):' | |||||
2331 | repo.__class__ = mqrepo |
|
2331 | repo.__class__ = mqrepo | |
2332 | repo.mq = queue(ui, repo.join("")) |
|
2332 | repo.mq = queue(ui, repo.join("")) | |
2333 |
|
2333 | |||
|
2334 | def uisetup(ui): | |||
|
2335 | # override import to disallow importing over patch | |||
|
2336 | importalias, importcmd = cmdutil.findcmd(ui, 'import', commands.table) | |||
|
2337 | for alias, cmd in commands.table.iteritems(): | |||
|
2338 | if cmd is importcmd: | |||
|
2339 | importkey = alias | |||
|
2340 | break | |||
|
2341 | orig_import = importcmd[0] | |||
|
2342 | def mqimport(ui, repo, patch1, *patches, **opts): | |||
|
2343 | if hasattr(repo, 'abort_if_wdir_patched'): | |||
|
2344 | repo.abort_if_wdir_patched(_('cannot import over an applied patch'), | |||
|
2345 | opts.get('force')) | |||
|
2346 | orig_import(ui, repo, patch1, *patches, **opts) | |||
|
2347 | importcmd = list(importcmd) | |||
|
2348 | importcmd[0] = mqimport | |||
|
2349 | commands.table[importkey] = tuple(importcmd) | |||
|
2350 | ||||
2334 | seriesopts = [('s', 'summary', None, _('print first line of patch header'))] |
|
2351 | seriesopts = [('s', 'summary', None, _('print first line of patch header'))] | |
2335 |
|
2352 | |||
2336 | cmdtable = { |
|
2353 | cmdtable = { |
@@ -199,6 +199,14 b' hg commit' | |||||
199 | echo % push should fail |
|
199 | echo % push should fail | |
200 | hg push ../../k |
|
200 | hg push ../../k | |
201 |
|
201 | |||
|
202 | echo % import should fail | |||
|
203 | hg st . | |||
|
204 | echo foo >> ../a | |||
|
205 | hg diff > ../../import.diff | |||
|
206 | hg revert --no-backup ../a | |||
|
207 | hg import ../../import.diff | |||
|
208 | hg st | |||
|
209 | ||||
202 | echo % qunapplied |
|
210 | echo % qunapplied | |
203 | hg qunapplied |
|
211 | hg qunapplied | |
204 |
|
212 |
@@ -169,6 +169,8 b' abort: cannot commit over an applied mq ' | |||||
169 | % push should fail |
|
169 | % push should fail | |
170 | pushing to ../../k |
|
170 | pushing to ../../k | |
171 | abort: source has mq patches applied |
|
171 | abort: source has mq patches applied | |
|
172 | % import should fail | |||
|
173 | abort: cannot import over an applied patch | |||
172 | % qunapplied |
|
174 | % qunapplied | |
173 | test2.patch |
|
175 | test2.patch | |
174 | % qpush/qpop with index |
|
176 | % qpush/qpop with index |
General Comments 0
You need to be logged in to leave comments.
Login now