##// END OF EJS Templates
import: simplify status reporting logic (and make it more I18N-friendly)...
Greg Ward -
r15194:0705f2ac default
parent child Browse files
Show More
@@ -3276,8 +3276,8 b' def import_(ui, repo, patch1, *patches, '
3276 patch.extract(ui, hunk)
3276 patch.extract(ui, hunk)
3277
3277
3278 if not tmpname:
3278 if not tmpname:
3279 return None
3279 return (None, None)
3280 commitid = _('to working directory')
3280 msg = _('applied to working directory')
3281
3281
3282 try:
3282 try:
3283 cmdline_message = cmdutil.logmessage(ui, opts)
3283 cmdline_message = cmdutil.logmessage(ui, opts)
@@ -3362,8 +3362,8 b' def import_(ui, repo, patch1, *patches, '
3362 finally:
3362 finally:
3363 store.close()
3363 store.close()
3364 if n:
3364 if n:
3365 commitid = short(n)
3365 msg = _('created %s') % short(n)
3366 return commitid
3366 return (msg, n)
3367 finally:
3367 finally:
3368 os.unlink(tmpname)
3368 os.unlink(tmpname)
3369
3369
@@ -3371,7 +3371,6 b' def import_(ui, repo, patch1, *patches, '
3371 wlock = repo.wlock()
3371 wlock = repo.wlock()
3372 lock = repo.lock()
3372 lock = repo.lock()
3373 parents = repo.parents()
3373 parents = repo.parents()
3374 lastcommit = None
3375 for p in patches:
3374 for p in patches:
3376 pf = os.path.join(d, p)
3375 pf = os.path.join(d, p)
3377
3376
@@ -3384,16 +3383,14 b' def import_(ui, repo, patch1, *patches, '
3384
3383
3385 haspatch = False
3384 haspatch = False
3386 for hunk in patch.split(pf):
3385 for hunk in patch.split(pf):
3387 commitid = tryone(ui, hunk, parents)
3386 (msg, node) = tryone(ui, hunk, parents)
3388 if commitid:
3387 if msg:
3389 haspatch = True
3388 haspatch = True
3390 if lastcommit:
3389 ui.note(msg + '\n')
3391 ui.status(_('applied %s\n') % lastcommit)
3392 lastcommit = commitid
3393 if update or opts.get('exact'):
3390 if update or opts.get('exact'):
3394 parents = repo.parents()
3391 parents = repo.parents()
3395 else:
3392 else:
3396 parents = [repo[commitid]]
3393 parents = [repo[node]]
3397
3394
3398 if not haspatch:
3395 if not haspatch:
3399 raise util.Abort(_('no diffs found'))
3396 raise util.Abort(_('no diffs found'))
@@ -171,7 +171,6 b' Test applying multiple patches'
171 $ hg import --bypass ../patch1.diff ../patch2.diff
171 $ hg import --bypass ../patch1.diff ../patch2.diff
172 applying ../patch1.diff
172 applying ../patch1.diff
173 applying ../patch2.diff
173 applying ../patch2.diff
174 applied 16581080145e
175 $ shortlog
174 $ shortlog
176 o 3:bc8ca3f8a7c4 test 0 0 - default - addf
175 o 3:bc8ca3f8a7c4 test 0 0 - default - addf
177 |
176 |
@@ -196,7 +195,6 b' Test applying multiple patches with --ex'
196 $ hg import --bypass --exact ../patch1.diff ../patch2.diff
195 $ hg import --bypass --exact ../patch1.diff ../patch2.diff
197 applying ../patch1.diff
196 applying ../patch1.diff
198 applying ../patch2.diff
197 applying ../patch2.diff
199 applied 16581080145e
200 $ shortlog
198 $ shortlog
201 o 3:d60cb8989666 test 0 0 - foo - addf
199 o 3:d60cb8989666 test 0 0 - foo - addf
202 |
200 |
@@ -199,7 +199,6 b' import two patches in one stream'
199 $ hg init b
199 $ hg init b
200 $ hg --cwd a export 0:tip | hg --cwd b import -
200 $ hg --cwd a export 0:tip | hg --cwd b import -
201 applying patch from stdin
201 applying patch from stdin
202 applied 80971e65b431
203 $ hg --cwd a id
202 $ hg --cwd a id
204 1d4bd90af0e4 tip
203 1d4bd90af0e4 tip
205 $ hg --cwd b id
204 $ hg --cwd b id
@@ -356,10 +355,15 b' patches: import patch1 patch2; rollback'
356 $ hg clone -qr0 a b
355 $ hg clone -qr0 a b
357 $ hg --cwd b parents --template 'parent: {rev}\n'
356 $ hg --cwd b parents --template 'parent: {rev}\n'
358 parent: 0
357 parent: 0
359 $ hg --cwd b import ../patch1 ../patch2
358 $ hg --cwd b import -v ../patch1 ../patch2
360 applying ../patch1
359 applying ../patch1
360 patching file a
361 a
362 created 1d4bd90af0e4
361 applying ../patch2
363 applying ../patch2
362 applied 1d4bd90af0e4
364 patching file a
365 a
366 created 6d019af21222
363 $ hg --cwd b rollback
367 $ hg --cwd b rollback
364 repository tip rolled back to revision 1 (undo commit)
368 repository tip rolled back to revision 1 (undo commit)
365 working directory now based on revision 1
369 working directory now based on revision 1
@@ -433,6 +437,7 b' Test fuzziness (ambiguous patch location'
433 applying fuzzy-tip.patch
437 applying fuzzy-tip.patch
434 patching file a
438 patching file a
435 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
439 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
440 applied to working directory
436 $ hg revert -a
441 $ hg revert -a
437 reverting a
442 reverting a
438
443
@@ -449,6 +454,7 b' test fuzziness with eol=auto'
449 applying fuzzy-tip.patch
454 applying fuzzy-tip.patch
450 patching file a
455 patching file a
451 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
456 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
457 applied to working directory
452 $ cd ..
458 $ cd ..
453
459
454
460
@@ -651,6 +657,7 b' test import with similarity and git and '
651 removing a
657 removing a
652 adding b
658 adding b
653 recording removal of a as rename to b (88% similar)
659 recording removal of a as rename to b (88% similar)
660 applied to working directory
654 $ hg st -C
661 $ hg st -C
655 A b
662 A b
656 a
663 a
@@ -665,6 +672,7 b' test import with similarity and git and '
665 patching file b
672 patching file b
666 removing a
673 removing a
667 adding b
674 adding b
675 applied to working directory
668 $ hg st -C
676 $ hg st -C
669 A b
677 A b
670 R a
678 R a
@@ -69,6 +69,7 b' import patch'
69 Hunk #2 succeeded at 87 (offset 34 lines).
69 Hunk #2 succeeded at 87 (offset 34 lines).
70 Hunk #3 succeeded at 109 (offset 34 lines).
70 Hunk #3 succeeded at 109 (offset 34 lines).
71 a
71 a
72 created 189885cecb41
72
73
73 compare imported changes against reference file
74 compare imported changes against reference file
74
75
@@ -37,7 +37,7 b' check custom patch options are honored'
37 $ hg --cwd b import -v ../a.diff
37 $ hg --cwd b import -v ../a.diff
38 applying ../a.diff
38 applying ../a.diff
39 Using custom patch
39 Using custom patch
40
40 applied to working directory
41
41
42 Issue2417: hg import with # comments in description
42 Issue2417: hg import with # comments in description
43
43
General Comments 0
You need to be logged in to leave comments. Login now