comparison tests/test-subrepo.t @ 18109:9e3910db4e78

subrepo: append subrepo path to subrepo error messages This change appends the subrepo path to subrepo errors. That is, when there is an error performing an operation a subrepo, rather than displaying a message such as: pushing subrepo MYSUBREPO to PATH searching for changes abort: push creates new remote head HEADHASH! hint: did you forget to merge? use push -f to force mercurial will show: pushing subrepo MYSUBREPO to PATH searching for changes abort: push creates new remote head HEADHASH! (in subrepo MYSUBREPO) hint: did you forget to merge? use push -f to force The rationale for this change is that the current error messages make it hard for TortoiseHg (and similar tools) to tell the user which subrepo caused the push failure. The "(in subrepo MYSUBREPO)" message has been added to those subrepo methods were it made sense (by using a decorator). We avoid appending "(in subrepo XXX)" multiple times when subrepos are nexted by throwing a "SubrepoAbort" exception after the extra message is appended. The decorator will then "ignore" (i.e. just re-raise) the exception and never add the message again. A small drawback of this method is that part of the exception trace is lost when the exception is catched and re-raised by the annotatesubrepoerror decorator. Also, because the state() function already printed the subrepo path when it threw an error, that error has been changed to avoid duplicating the subrepo path in the error message. Note that I have also updated several subrepo related tests to reflect these changes.
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Thu, 13 Dec 2012 23:37:53 +0100
parents fd903f89e42b
children f254ab6207ae
comparison
equal deleted inserted replaced
18108:bc694d78d843 18109:9e3910db4e78
318 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) 318 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
319 searching for changes 319 searching for changes
320 no changes found 320 no changes found
321 pushing subrepo s to $TESTTMP/t/s (glob) 321 pushing subrepo s to $TESTTMP/t/s (glob)
322 searching for changes 322 searching for changes
323 abort: push creates new remote head 12a213df6fa9! 323 abort: push creates new remote head 12a213df6fa9! (in subrepo s)
324 (did you forget to merge? use push -f to force) 324 (did you forget to merge? use push -f to force)
325 [255] 325 [255]
326 $ hg push -f 326 $ hg push -f
327 pushing to $TESTTMP/t (glob) 327 pushing to $TESTTMP/t (glob)
328 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) 328 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
585 $ hg -R repo2/s ci -m3 -A 585 $ hg -R repo2/s ci -m3 -A
586 adding b 586 adding b
587 created new head 587 created new head
588 $ hg -R repo2 ci -m3 588 $ hg -R repo2 ci -m3
589 $ hg -q -R repo2 push 589 $ hg -q -R repo2 push
590 abort: push creates new remote head cc505f09a8b2! 590 abort: push creates new remote head cc505f09a8b2! (in subrepo s)
591 (did you forget to merge? use push -f to force) 591 (did you forget to merge? use push -f to force)
592 [255] 592 [255]
593 $ hg -R repo update 593 $ hg -R repo update
594 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 594 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
595 595
597 597
598 $ echo issue3276_ok > repo/s/b 598 $ echo issue3276_ok > repo/s/b
599 $ hg -R repo2 push -f -q 599 $ hg -R repo2 push -f -q
600 $ hg -R repo update 600 $ hg -R repo update
601 b: untracked file differs 601 b: untracked file differs
602 abort: untracked files in working directory differ from files in requested revision 602 abort: untracked files in working directory differ from files in requested revision (in subrepo s)
603 [255] 603 [255]
604 604
605 $ cat repo/s/b 605 $ cat repo/s/b
606 issue3276_ok 606 issue3276_ok
607 $ rm repo/s/b 607 $ rm repo/s/b
643 adding manifests 643 adding manifests
644 adding file changes 644 adding file changes
645 added 2 changesets with 3 changes to 2 files 645 added 2 changesets with 3 changes to 2 files
646 (run 'hg update' to get a working copy) 646 (run 'hg update' to get a working copy)
647 $ hg -R issue1852b update 647 $ hg -R issue1852b update
648 abort: default path for subrepository sub/repo not found (glob) 648 abort: default path for subrepository not found (in subrepo sub/repo) (glob)
649 [255] 649 [255]
650 650
651 Pull -u now doesn't help 651 Pull -u now doesn't help
652 652
653 $ hg -R issue1852b pull -u issue1852a 653 $ hg -R issue1852b pull -u issue1852a