Mercurial > hg
comparison hgext/fetch.py @ 26587:56b2bcea2529
error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.
For great justice.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 08 Oct 2015 12:55:45 -0700 |
parents | 80c5b2666a96 |
children | 9dcc9ed26d33 |
comparison
equal
deleted
inserted
replaced
26586:d51c658d3f04 | 26587:56b2bcea2529 |
---|---|
58 try: | 58 try: |
59 branchnode = repo.branchtip(branch) | 59 branchnode = repo.branchtip(branch) |
60 except error.RepoLookupError: | 60 except error.RepoLookupError: |
61 branchnode = None | 61 branchnode = None |
62 if parent != branchnode: | 62 if parent != branchnode: |
63 raise util.Abort(_('working directory not at branch tip'), | 63 raise error.Abort(_('working directory not at branch tip'), |
64 hint=_('use "hg update" to check out branch tip')) | 64 hint=_('use "hg update" to check out branch tip')) |
65 | 65 |
66 wlock = lock = None | 66 wlock = lock = None |
67 try: | 67 try: |
68 wlock = repo.wlock() | 68 wlock = repo.wlock() |
71 cmdutil.bailifchanged(repo) | 71 cmdutil.bailifchanged(repo) |
72 | 72 |
73 bheads = repo.branchheads(branch) | 73 bheads = repo.branchheads(branch) |
74 bheads = [head for head in bheads if len(repo[head].children()) == 0] | 74 bheads = [head for head in bheads if len(repo[head].children()) == 0] |
75 if len(bheads) > 1: | 75 if len(bheads) > 1: |
76 raise util.Abort(_('multiple heads in this branch ' | 76 raise error.Abort(_('multiple heads in this branch ' |
77 '(use "hg heads ." and "hg merge" to merge)')) | 77 '(use "hg heads ." and "hg merge" to merge)')) |
78 | 78 |
79 other = hg.peer(repo, opts, ui.expandpath(source)) | 79 other = hg.peer(repo, opts, ui.expandpath(source)) |
80 ui.status(_('pulling from %s\n') % | 80 ui.status(_('pulling from %s\n') % |
81 util.hidepassword(ui.expandpath(source))) | 81 util.hidepassword(ui.expandpath(source))) |
84 try: | 84 try: |
85 revs = [other.lookup(rev) for rev in opts['rev']] | 85 revs = [other.lookup(rev) for rev in opts['rev']] |
86 except error.CapabilityError: | 86 except error.CapabilityError: |
87 err = _("other repository doesn't support revision lookup, " | 87 err = _("other repository doesn't support revision lookup, " |
88 "so a rev cannot be specified.") | 88 "so a rev cannot be specified.") |
89 raise util.Abort(err) | 89 raise error.Abort(err) |
90 | 90 |
91 # Are there any changes at all? | 91 # Are there any changes at all? |
92 modheads = exchange.pull(repo, other, heads=revs).cgresult | 92 modheads = exchange.pull(repo, other, heads=revs).cgresult |
93 if modheads == 0: | 93 if modheads == 0: |
94 return 0 | 94 return 0 |