Show More
@@ -5,7 +5,7 demandimport.enable() | |||
|
5 | 5 | |
|
6 | 6 | import sys |
|
7 | 7 | from mercurial.i18n import _ |
|
8 | from mercurial import simplemerge, fancyopts, util, ui | |
|
8 | from mercurial import error, simplemerge, fancyopts, util, ui | |
|
9 | 9 | |
|
10 | 10 | options = [('L', 'label', [], _('labels to use on conflict markers')), |
|
11 | 11 | ('a', 'text', None, _('treat all files as text')), |
@@ -59,7 +59,7 except ParseError, e: | |||
|
59 | 59 | sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) |
|
60 | 60 | showhelp() |
|
61 | 61 | sys.exit(1) |
|
62 |
except |
|
|
62 | except error.Abort, e: | |
|
63 | 63 | sys.stderr.write("abort: %s\n" % e) |
|
64 | 64 | sys.exit(255) |
|
65 | 65 | except KeyboardInterrupt: |
@@ -37,7 +37,7 A few obvious properties that are not cu | |||
|
37 | 37 | ''' |
|
38 | 38 | |
|
39 | 39 | import bisect, collections, itertools, json, os, random, time, sys |
|
40 | from mercurial import cmdutil, context, patch, scmutil, util, hg | |
|
40 | from mercurial import cmdutil, context, patch, scmutil, util, hg, error | |
|
41 | 41 | from mercurial.i18n import _ |
|
42 | 42 | from mercurial.node import nullrev, nullid, short |
|
43 | 43 | |
@@ -254,7 +254,7 def synthesize(ui, repo, descpath, **opt | |||
|
254 | 254 | try: |
|
255 | 255 | fp = hg.openpath(ui, descpath) |
|
256 | 256 | except Exception as err: |
|
257 |
raise |
|
|
257 | raise error.Abort('%s: %s' % (descpath, err[0].strerror)) | |
|
258 | 258 | desc = json.load(fp) |
|
259 | 259 | fp.close() |
|
260 | 260 | |
@@ -286,7 +286,7 def synthesize(ui, repo, descpath, **opt | |||
|
286 | 286 | try: |
|
287 | 287 | fp = open(dictfile, 'rU') |
|
288 | 288 | except IOError as err: |
|
289 |
raise |
|
|
289 | raise error.Abort('%s: %s' % (dictfile, err.strerror)) | |
|
290 | 290 | words = fp.read().splitlines() |
|
291 | 291 | fp.close() |
|
292 | 292 |
@@ -192,7 +192,7 3) Deny access to a file to anyone but u | |||
|
192 | 192 | ''' |
|
193 | 193 | |
|
194 | 194 | from mercurial.i18n import _ |
|
195 | from mercurial import util, match | |
|
195 | from mercurial import util, match, error | |
|
196 | 196 | import getpass, urllib |
|
197 | 197 | |
|
198 | 198 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
@@ -213,7 +213,7 def _getusers(ui, group): | |||
|
213 | 213 | try: |
|
214 | 214 | return util.groupmembers(group) |
|
215 | 215 | except KeyError: |
|
216 |
raise |
|
|
216 | raise error.Abort(_("group '%s' is undefined") % group) | |
|
217 | 217 | |
|
218 | 218 | def _usermatch(ui, user, usersorgroups): |
|
219 | 219 | |
@@ -268,7 +268,7 def buildmatch(ui, repo, user, key): | |||
|
268 | 268 | |
|
269 | 269 | def hook(ui, repo, hooktype, node=None, source=None, **kwargs): |
|
270 | 270 | if hooktype not in ['pretxnchangegroup', 'pretxncommit']: |
|
271 |
raise |
|
|
271 | raise error.Abort(_('config error - hook type "%s" cannot stop ' | |
|
272 | 272 | 'incoming changesets nor commits') % hooktype) |
|
273 | 273 | if (hooktype == 'pretxnchangegroup' and |
|
274 | 274 | source not in ui.config('acl', 'sources', 'serve').split()): |
@@ -301,11 +301,11 def hook(ui, repo, hooktype, node=None, | |||
|
301 | 301 | ctx = repo[rev] |
|
302 | 302 | branch = ctx.branch() |
|
303 | 303 | if denybranches and denybranches(branch): |
|
304 |
raise |
|
|
304 | raise error.Abort(_('acl: user "%s" denied on branch "%s"' | |
|
305 | 305 | ' (changeset "%s")') |
|
306 | 306 | % (user, branch, ctx)) |
|
307 | 307 | if allowbranches and not allowbranches(branch): |
|
308 |
raise |
|
|
308 | raise error.Abort(_('acl: user "%s" not allowed on branch "%s"' | |
|
309 | 309 | ' (changeset "%s")') |
|
310 | 310 | % (user, branch, ctx)) |
|
311 | 311 | ui.debug('acl: branch access granted: "%s" on branch "%s"\n' |
@@ -313,9 +313,9 def hook(ui, repo, hooktype, node=None, | |||
|
313 | 313 | |
|
314 | 314 | for f in ctx.files(): |
|
315 | 315 | if deny and deny(f): |
|
316 |
raise |
|
|
316 | raise error.Abort(_('acl: user "%s" denied on "%s"' | |
|
317 | 317 | ' (changeset "%s")') % (user, f, ctx)) |
|
318 | 318 | if allow and not allow(f): |
|
319 |
raise |
|
|
319 | raise error.Abort(_('acl: user "%s" not allowed on "%s"' | |
|
320 | 320 | ' (changeset "%s")') % (user, f, ctx)) |
|
321 | 321 | ui.debug('acl: path access granted: "%s"\n' % ctx) |
@@ -279,7 +279,7 All the above add a comment to the Bugzi | |||
|
279 | 279 | |
|
280 | 280 | from mercurial.i18n import _ |
|
281 | 281 | from mercurial.node import short |
|
282 | from mercurial import cmdutil, mail, util | |
|
282 | from mercurial import cmdutil, mail, util, error | |
|
283 | 283 | import re, time, urlparse, xmlrpclib |
|
284 | 284 | |
|
285 | 285 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
@@ -358,7 +358,7 class bzmysql(bzaccess): | |||
|
358 | 358 | import MySQLdb as mysql |
|
359 | 359 | bzmysql._MySQLdb = mysql |
|
360 | 360 | except ImportError as err: |
|
361 |
raise |
|
|
361 | raise error.Abort(_('python mysql support not available: %s') % err) | |
|
362 | 362 | |
|
363 | 363 | bzaccess.__init__(self, ui) |
|
364 | 364 | |
@@ -392,7 +392,7 class bzmysql(bzaccess): | |||
|
392 | 392 | self.run('select fieldid from fielddefs where name = "longdesc"') |
|
393 | 393 | ids = self.cursor.fetchall() |
|
394 | 394 | if len(ids) != 1: |
|
395 |
raise |
|
|
395 | raise error.Abort(_('unknown database schema')) | |
|
396 | 396 | return ids[0][0] |
|
397 | 397 | |
|
398 | 398 | def filter_real_bug_ids(self, bugs): |
@@ -437,7 +437,7 class bzmysql(bzaccess): | |||
|
437 | 437 | ret = fp.close() |
|
438 | 438 | if ret: |
|
439 | 439 | self.ui.warn(out) |
|
440 |
raise |
|
|
440 | raise error.Abort(_('bugzilla notify command %s') % | |
|
441 | 441 | util.explainexit(ret)[0]) |
|
442 | 442 | self.ui.status(_('done\n')) |
|
443 | 443 | |
@@ -470,12 +470,12 class bzmysql(bzaccess): | |||
|
470 | 470 | try: |
|
471 | 471 | defaultuser = self.ui.config('bugzilla', 'bzuser') |
|
472 | 472 | if not defaultuser: |
|
473 |
raise |
|
|
473 | raise error.Abort(_('cannot find bugzilla user id for %s') % | |
|
474 | 474 | user) |
|
475 | 475 | userid = self.get_user_id(defaultuser) |
|
476 | 476 | user = defaultuser |
|
477 | 477 | except KeyError: |
|
478 |
raise |
|
|
478 | raise error.Abort(_('cannot find bugzilla user id for %s or %s') | |
|
479 | 479 | % (user, defaultuser)) |
|
480 | 480 | return (user, userid) |
|
481 | 481 | |
@@ -517,7 +517,7 class bzmysql_3_0(bzmysql_2_18): | |||
|
517 | 517 | self.run('select id from fielddefs where name = "longdesc"') |
|
518 | 518 | ids = self.cursor.fetchall() |
|
519 | 519 | if len(ids) != 1: |
|
520 |
raise |
|
|
520 | raise error.Abort(_('unknown database schema')) | |
|
521 | 521 | return ids[0][0] |
|
522 | 522 | |
|
523 | 523 | # Bugzilla via XMLRPC interface. |
@@ -705,7 +705,7 class bzxmlrpcemail(bzxmlrpc): | |||
|
705 | 705 | |
|
706 | 706 | self.bzemail = self.ui.config('bugzilla', 'bzemail') |
|
707 | 707 | if not self.bzemail: |
|
708 |
raise |
|
|
708 | raise error.Abort(_("configuration 'bzemail' missing")) | |
|
709 | 709 | mail.validateconfig(self.ui) |
|
710 | 710 | |
|
711 | 711 | def makecommandline(self, fieldname, value): |
@@ -735,8 +735,8 class bzxmlrpcemail(bzxmlrpc): | |||
|
735 | 735 | matches = self.bzproxy.User.get({'match': [user], |
|
736 | 736 | 'token': self.bztoken}) |
|
737 | 737 | if not matches['users']: |
|
738 |
raise |
|
|
739 | user) | |
|
738 | raise error.Abort(_("default bugzilla user %s email not found") | |
|
739 | % user) | |
|
740 | 740 | user = matches['users'][0]['email'] |
|
741 | 741 | commands.append(self.makecommandline("id", bugid)) |
|
742 | 742 | |
@@ -789,7 +789,7 class bugzilla(object): | |||
|
789 | 789 | try: |
|
790 | 790 | bzclass = bugzilla._versions[bzversion] |
|
791 | 791 | except KeyError: |
|
792 |
raise |
|
|
792 | raise error.Abort(_('bugzilla version %s not supported') % | |
|
793 | 793 | bzversion) |
|
794 | 794 | self.bzdriver = bzclass(self.ui) |
|
795 | 795 | |
@@ -900,7 +900,7 def hook(ui, repo, hooktype, node=None, | |||
|
900 | 900 | bugzilla bug id. only add a comment once per bug, so same change |
|
901 | 901 | seen multiple times does not fill bug with duplicate data.''' |
|
902 | 902 | if node is None: |
|
903 |
raise |
|
|
903 | raise error.Abort(_('hook type %s does not pass a changeset id') % | |
|
904 | 904 | hooktype) |
|
905 | 905 | try: |
|
906 | 906 | bz = bugzilla(ui, repo) |
@@ -911,4 +911,4 def hook(ui, repo, hooktype, node=None, | |||
|
911 | 911 | bz.update(bug, bugs[bug], ctx) |
|
912 | 912 | bz.notify(bugs, util.email(ctx.user())) |
|
913 | 913 | except Exception as e: |
|
914 |
raise |
|
|
914 | raise error.Abort(_('Bugzilla error: %s') % e) |
@@ -43,47 +43,47 testedwith = 'internal' | |||
|
43 | 43 | _('-r REV [-t TEXT] [FILE]')) |
|
44 | 44 | def censor(ui, repo, path, rev='', tombstone='', **opts): |
|
45 | 45 | if not path: |
|
46 |
raise |
|
|
46 | raise error.Abort(_('must specify file path to censor')) | |
|
47 | 47 | if not rev: |
|
48 |
raise |
|
|
48 | raise error.Abort(_('must specify revision to censor')) | |
|
49 | 49 | |
|
50 | 50 | wctx = repo[None] |
|
51 | 51 | |
|
52 | 52 | m = scmutil.match(wctx, (path,)) |
|
53 | 53 | if m.anypats() or len(m.files()) != 1: |
|
54 |
raise |
|
|
54 | raise error.Abort(_('can only specify an explicit filename')) | |
|
55 | 55 | path = m.files()[0] |
|
56 | 56 | flog = repo.file(path) |
|
57 | 57 | if not len(flog): |
|
58 |
raise |
|
|
58 | raise error.Abort(_('cannot censor file with no history')) | |
|
59 | 59 | |
|
60 | 60 | rev = scmutil.revsingle(repo, rev, rev).rev() |
|
61 | 61 | try: |
|
62 | 62 | ctx = repo[rev] |
|
63 | 63 | except KeyError: |
|
64 |
raise |
|
|
64 | raise error.Abort(_('invalid revision identifier %s') % rev) | |
|
65 | 65 | |
|
66 | 66 | try: |
|
67 | 67 | fctx = ctx.filectx(path) |
|
68 | 68 | except error.LookupError: |
|
69 |
raise |
|
|
69 | raise error.Abort(_('file does not exist at revision %s') % rev) | |
|
70 | 70 | |
|
71 | 71 | fnode = fctx.filenode() |
|
72 | 72 | headctxs = [repo[c] for c in repo.heads()] |
|
73 | 73 | heads = [c for c in headctxs if path in c and c.filenode(path) == fnode] |
|
74 | 74 | if heads: |
|
75 | 75 | headlist = ', '.join([short(c.node()) for c in heads]) |
|
76 |
raise |
|
|
76 | raise error.Abort(_('cannot censor file in heads (%s)') % headlist, | |
|
77 | 77 | hint=_('clean/delete and commit first')) |
|
78 | 78 | |
|
79 | 79 | wp = wctx.parents() |
|
80 | 80 | if ctx.node() in [p.node() for p in wp]: |
|
81 |
raise |
|
|
81 | raise error.Abort(_('cannot censor working directory'), | |
|
82 | 82 | hint=_('clean/delete/update first')) |
|
83 | 83 | |
|
84 | 84 | flogv = flog.version & 0xFFFF |
|
85 | 85 | if flogv != revlog.REVLOGNG: |
|
86 |
raise |
|
|
86 | raise error.Abort( | |
|
87 | 87 | _('censor does not support revlog version %d') % (flogv,)) |
|
88 | 88 | |
|
89 | 89 | tombstone = filelog.packmeta({"censored": tombstone}, "") |
@@ -91,7 +91,7 def censor(ui, repo, path, rev='', tombs | |||
|
91 | 91 | crev = fctx.filerev() |
|
92 | 92 | |
|
93 | 93 | if len(tombstone) > flog.rawsize(crev): |
|
94 |
raise |
|
|
94 | raise error.Abort(_( | |
|
95 | 95 | 'censor tombstone must be no longer than censored data')) |
|
96 | 96 | |
|
97 | 97 | # Using two files instead of one makes it easy to rewrite entry-by-entry |
@@ -9,7 +9,7 | |||
|
9 | 9 | '''command to display statistics about repository history''' |
|
10 | 10 | |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | from mercurial import patch, cmdutil, scmutil, util, commands | |
|
12 | from mercurial import patch, cmdutil, scmutil, util, commands, error | |
|
13 | 13 | from mercurial import encoding |
|
14 | 14 | import os |
|
15 | 15 | import time, datetime |
@@ -27,7 +27,7 def maketemplater(ui, repo, tmpl): | |||
|
27 | 27 | t = cmdutil.changeset_templater(ui, repo, False, None, tmpl, |
|
28 | 28 | None, False) |
|
29 | 29 | except SyntaxError as inst: |
|
30 |
raise |
|
|
30 | raise error.Abort(inst.args[0]) | |
|
31 | 31 | return t |
|
32 | 32 | |
|
33 | 33 | def changedlines(ui, repo, ctx1, ctx2, fns): |
@@ -9,7 +9,7 | |||
|
9 | 9 | # it cannot access 'bar' repositories, but they were never used very much |
|
10 | 10 | |
|
11 | 11 | import os |
|
12 | from mercurial import demandimport | |
|
12 | from mercurial import demandimport, error | |
|
13 | 13 | # these do not work with demandimport, blacklist |
|
14 | 14 | demandimport.ignore.extend([ |
|
15 | 15 | 'bzrlib.transactions', |
@@ -18,7 +18,7 demandimport.ignore.extend([ | |||
|
18 | 18 | ]) |
|
19 | 19 | |
|
20 | 20 | from mercurial.i18n import _ |
|
21 |
from mercurial import |
|
|
21 | from mercurial import error | |
|
22 | 22 | from common import NoRepo, commit, converter_source |
|
23 | 23 | |
|
24 | 24 | try: |
@@ -108,7 +108,8 class bzr_source(converter_source): | |||
|
108 | 108 | pass |
|
109 | 109 | revid = info.rev_id |
|
110 | 110 | if revid is None: |
|
111 |
raise |
|
|
111 | raise error.Abort(_('%s is not a valid revision') | |
|
112 | % self.revs[0]) | |
|
112 | 113 | heads = [revid] |
|
113 | 114 | # Empty repositories return 'null:', which cannot be retrieved |
|
114 | 115 | heads = [h for h in heads if h != 'null:'] |
@@ -127,7 +128,7 class bzr_source(converter_source): | |||
|
127 | 128 | if kind == 'symlink': |
|
128 | 129 | target = revtree.get_symlink_target(fileid) |
|
129 | 130 | if target is None: |
|
130 |
raise |
|
|
131 | raise error.Abort(_('%s.%s symlink has no target') | |
|
131 | 132 | % (name, rev)) |
|
132 | 133 | return target, mode |
|
133 | 134 | else: |
@@ -136,7 +137,7 class bzr_source(converter_source): | |||
|
136 | 137 | |
|
137 | 138 | def getchanges(self, version, full): |
|
138 | 139 | if full: |
|
139 |
raise |
|
|
140 | raise error.Abort(_("convert from cvs do not support --full")) | |
|
140 | 141 | self._modecache = {} |
|
141 | 142 | self._revtree = self.sourcerepo.revision_tree(version) |
|
142 | 143 | # get the parentids from the cache |
@@ -7,7 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | import base64, errno, subprocess, os, datetime, re |
|
9 | 9 | import cPickle as pickle |
|
10 | from mercurial import phases, util | |
|
10 | from mercurial import phases, util, error | |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | 12 | |
|
13 | 13 | propertycache = util.propertycache |
@@ -32,7 +32,7 def checktool(exe, name=None, abort=True | |||
|
32 | 32 | name = name or exe |
|
33 | 33 | if not util.findexe(exe): |
|
34 | 34 | if abort: |
|
35 |
exc = |
|
|
35 | exc = error.Abort | |
|
36 | 36 | else: |
|
37 | 37 | exc = MissingTool |
|
38 | 38 | raise exc(_('cannot find required "%s" tool') % name) |
@@ -73,7 +73,7 class converter_source(object): | |||
|
73 | 73 | such format for their revision numbering |
|
74 | 74 | """ |
|
75 | 75 | if not re.match(r'[0-9a-fA-F]{40,40}$', revstr): |
|
76 |
raise |
|
|
76 | raise error.Abort(_('%s entry %s is not a valid revision' | |
|
77 | 77 | ' identifier') % (mapname, revstr)) |
|
78 | 78 | |
|
79 | 79 | def before(self): |
@@ -369,7 +369,7 class commandline(object): | |||
|
369 | 369 | self.ui.warn(_('%s error:\n') % self.command) |
|
370 | 370 | self.ui.warn(output) |
|
371 | 371 | msg = util.explainexit(status)[0] |
|
372 |
raise |
|
|
372 | raise error.Abort('%s %s' % (self.command, msg)) | |
|
373 | 373 | |
|
374 | 374 | def run0(self, cmd, *args, **kwargs): |
|
375 | 375 | output, status = self.run(cmd, *args, **kwargs) |
@@ -446,7 +446,7 class mapfile(dict): | |||
|
446 | 446 | try: |
|
447 | 447 | key, value = line.rsplit(' ', 1) |
|
448 | 448 | except ValueError: |
|
449 |
raise |
|
|
449 | raise error.Abort( | |
|
450 | 450 | _('syntax error in %s(%d): key/value pair expected') |
|
451 | 451 | % (self.path, i + 1)) |
|
452 | 452 | if key not in self: |
@@ -459,7 +459,7 class mapfile(dict): | |||
|
459 | 459 | try: |
|
460 | 460 | self.fp = open(self.path, 'a') |
|
461 | 461 | except IOError as err: |
|
462 |
raise |
|
|
462 | raise error.Abort(_('could not open map file %r: %s') % | |
|
463 | 463 | (self.path, err.strerror)) |
|
464 | 464 | self.fp.write('%s %s\n' % (key, value)) |
|
465 | 465 | self.fp.flush() |
@@ -18,7 +18,7 from p4 import p4_source | |||
|
18 | 18 | import filemap |
|
19 | 19 | |
|
20 | 20 | import os, shutil, shlex |
|
21 | from mercurial import hg, util, encoding | |
|
21 | from mercurial import hg, util, encoding, error | |
|
22 | 22 | from mercurial.i18n import _ |
|
23 | 23 | |
|
24 | 24 | orig_encoding = 'ascii' |
@@ -82,7 +82,7 sink_converters = [ | |||
|
82 | 82 | def convertsource(ui, path, type, revs): |
|
83 | 83 | exceptions = [] |
|
84 | 84 | if type and type not in [s[0] for s in source_converters]: |
|
85 |
raise |
|
|
85 | raise error.Abort(_('%s: invalid source repository type') % type) | |
|
86 | 86 | for name, source, sortmode in source_converters: |
|
87 | 87 | try: |
|
88 | 88 | if not type or name == type: |
@@ -92,11 +92,11 def convertsource(ui, path, type, revs): | |||
|
92 | 92 | if not ui.quiet: |
|
93 | 93 | for inst in exceptions: |
|
94 | 94 | ui.write("%s\n" % inst) |
|
95 |
raise |
|
|
95 | raise error.Abort(_('%s: missing or unsupported repository') % path) | |
|
96 | 96 | |
|
97 | 97 | def convertsink(ui, path, type): |
|
98 | 98 | if type and type not in [s[0] for s in sink_converters]: |
|
99 |
raise |
|
|
99 | raise error.Abort(_('%s: invalid destination repository type') % type) | |
|
100 | 100 | for name, sink in sink_converters: |
|
101 | 101 | try: |
|
102 | 102 | if not type or name == type: |
@@ -104,8 +104,8 def convertsink(ui, path, type): | |||
|
104 | 104 | except NoRepo as inst: |
|
105 | 105 | ui.note(_("convert: %s\n") % inst) |
|
106 | 106 | except MissingTool as inst: |
|
107 |
raise |
|
|
108 |
raise |
|
|
107 | raise error.Abort('%s\n' % inst) | |
|
108 | raise error.Abort(_('%s: unknown repository type') % path) | |
|
109 | 109 | |
|
110 | 110 | class progresssource(object): |
|
111 | 111 | def __init__(self, ui, source, filecount): |
@@ -185,7 +185,7 class converter(object): | |||
|
185 | 185 | line = list(lex) |
|
186 | 186 | # check number of parents |
|
187 | 187 | if not (2 <= len(line) <= 3): |
|
188 |
raise |
|
|
188 | raise error.Abort(_('syntax error in %s(%d): child parent1' | |
|
189 | 189 | '[,parent2] expected') % (path, i + 1)) |
|
190 | 190 | for part in line: |
|
191 | 191 | self.source.checkrevformat(part) |
@@ -196,7 +196,7 class converter(object): | |||
|
196 | 196 | m[child] = p1 + p2 |
|
197 | 197 | # if file does not exist or error reading, exit |
|
198 | 198 | except IOError: |
|
199 |
raise |
|
|
199 | raise error.Abort(_('splicemap file not found or error reading %s:') | |
|
200 | 200 | % path) |
|
201 | 201 | return m |
|
202 | 202 | |
@@ -247,7 +247,7 class converter(object): | |||
|
247 | 247 | continue |
|
248 | 248 | # Parent is not in dest and not being converted, not good |
|
249 | 249 | if p not in parents: |
|
250 |
raise |
|
|
250 | raise error.Abort(_('unknown splice map parent: %s') % p) | |
|
251 | 251 | pc.append(p) |
|
252 | 252 | parents[c] = pc |
|
253 | 253 | |
@@ -343,7 +343,7 class converter(object): | |||
|
343 | 343 | elif sortmode == 'closesort': |
|
344 | 344 | picknext = makeclosesorter() |
|
345 | 345 | else: |
|
346 |
raise |
|
|
346 | raise error.Abort(_('unknown sort mode: %s') % sortmode) | |
|
347 | 347 | |
|
348 | 348 | children, actives = mapchildren(parents) |
|
349 | 349 | |
@@ -361,7 +361,7 class converter(object): | |||
|
361 | 361 | try: |
|
362 | 362 | pendings[c].remove(n) |
|
363 | 363 | except ValueError: |
|
364 |
raise |
|
|
364 | raise error.Abort(_('cycle detected between %s and %s') | |
|
365 | 365 | % (recode(c), recode(n))) |
|
366 | 366 | if not pendings[c]: |
|
367 | 367 | # Parents are converted, node is eligible |
@@ -369,7 +369,7 class converter(object): | |||
|
369 | 369 | pendings[c] = None |
|
370 | 370 | |
|
371 | 371 | if len(s) != len(parents): |
|
372 |
raise |
|
|
372 | raise error.Abort(_("not all revisions were sorted")) | |
|
373 | 373 | |
|
374 | 374 | return s |
|
375 | 375 | |
@@ -556,16 +556,17 def convert(ui, src, dest=None, revmapfi | |||
|
556 | 556 | sortmodes = ('branchsort', 'datesort', 'sourcesort', 'closesort') |
|
557 | 557 | sortmode = [m for m in sortmodes if opts.get(m)] |
|
558 | 558 | if len(sortmode) > 1: |
|
559 |
raise |
|
|
559 | raise error.Abort(_('more than one sort mode specified')) | |
|
560 | 560 | if sortmode: |
|
561 | 561 | sortmode = sortmode[0] |
|
562 | 562 | else: |
|
563 | 563 | sortmode = defaultsort |
|
564 | 564 | |
|
565 | 565 | if sortmode == 'sourcesort' and not srcc.hasnativeorder(): |
|
566 |
raise |
|
|
566 | raise error.Abort(_('--sourcesort is not supported by this data source') | |
|
567 | ) | |
|
567 | 568 | if sortmode == 'closesort' and not srcc.hasnativeclose(): |
|
568 |
raise |
|
|
569 | raise error.Abort(_('--closesort is not supported by this data source')) | |
|
569 | 570 | |
|
570 | 571 | fmap = opts.get('filemap') |
|
571 | 572 | if fmap: |
@@ -7,7 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | import os, re, socket, errno |
|
9 | 9 | from cStringIO import StringIO |
|
10 | from mercurial import encoding, util | |
|
10 | from mercurial import encoding, util, error | |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | 12 | |
|
13 | 13 | from common import NoRepo, commit, converter_source, checktool |
@@ -43,14 +43,14 class convert_cvs(converter_source): | |||
|
43 | 43 | maxrev = 0 |
|
44 | 44 | if self.revs: |
|
45 | 45 | if len(self.revs) > 1: |
|
46 |
raise |
|
|
46 | raise error.Abort(_('cvs source does not support specifying ' | |
|
47 | 47 | 'multiple revs')) |
|
48 | 48 | # TODO: handle tags |
|
49 | 49 | try: |
|
50 | 50 | # patchset number? |
|
51 | 51 | maxrev = int(self.revs[0]) |
|
52 | 52 | except ValueError: |
|
53 |
raise |
|
|
53 | raise error.Abort(_('revision %s is not a patchset number') | |
|
54 | 54 | % self.revs[0]) |
|
55 | 55 | |
|
56 | 56 | d = os.getcwd() |
@@ -150,7 +150,7 class convert_cvs(converter_source): | |||
|
150 | 150 | sck.send("\n".join(["BEGIN AUTH REQUEST", root, user, passw, |
|
151 | 151 | "END AUTH REQUEST", ""])) |
|
152 | 152 | if sck.recv(128) != "I LOVE YOU\n": |
|
153 |
raise |
|
|
153 | raise error.Abort(_("CVS pserver authentication failed")) | |
|
154 | 154 | |
|
155 | 155 | self.writep = self.readp = sck.makefile('r+') |
|
156 | 156 | |
@@ -193,7 +193,7 class convert_cvs(converter_source): | |||
|
193 | 193 | self.writep.flush() |
|
194 | 194 | r = self.readp.readline() |
|
195 | 195 | if not r.startswith("Valid-requests"): |
|
196 |
raise |
|
|
196 | raise error.Abort(_('unexpected response from CVS server ' | |
|
197 | 197 | '(expected "Valid-requests", but got %r)') |
|
198 | 198 | % r) |
|
199 | 199 | if "UseUnchanged" in r: |
@@ -215,7 +215,7 class convert_cvs(converter_source): | |||
|
215 | 215 | while count > 0: |
|
216 | 216 | data = fp.read(min(count, chunksize)) |
|
217 | 217 | if not data: |
|
218 |
raise |
|
|
218 | raise error.Abort(_("%d bytes missing from remote file") | |
|
219 | 219 | % count) |
|
220 | 220 | count -= len(data) |
|
221 | 221 | output.write(data) |
@@ -252,18 +252,18 class convert_cvs(converter_source): | |||
|
252 | 252 | else: |
|
253 | 253 | if line == "ok\n": |
|
254 | 254 | if mode is None: |
|
255 |
raise |
|
|
255 | raise error.Abort(_('malformed response from CVS')) | |
|
256 | 256 | return (data, "x" in mode and "x" or "") |
|
257 | 257 | elif line.startswith("E "): |
|
258 | 258 | self.ui.warn(_("cvs server: %s\n") % line[2:]) |
|
259 | 259 | elif line.startswith("Remove"): |
|
260 | 260 | self.readp.readline() |
|
261 | 261 | else: |
|
262 |
raise |
|
|
262 | raise error.Abort(_("unknown CVS response: %s") % line) | |
|
263 | 263 | |
|
264 | 264 | def getchanges(self, rev, full): |
|
265 | 265 | if full: |
|
266 |
raise |
|
|
266 | raise error.Abort(_("convert from cvs do not support --full")) | |
|
267 | 267 | self._parse() |
|
268 | 268 | return sorted(self.files[rev].iteritems()), {}, set() |
|
269 | 269 |
@@ -7,7 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | from common import NoRepo, checktool, commandline, commit, converter_source |
|
9 | 9 | from mercurial.i18n import _ |
|
10 | from mercurial import util | |
|
10 | from mercurial import util, error | |
|
11 | 11 | import os, shutil, tempfile, re, errno |
|
12 | 12 | |
|
13 | 13 | # The naming drift of ElementTree is fun! |
@@ -39,11 +39,11 class darcs_source(converter_source, com | |||
|
39 | 39 | checktool('darcs') |
|
40 | 40 | version = self.run0('--version').splitlines()[0].strip() |
|
41 | 41 | if version < '2.1': |
|
42 |
raise |
|
|
43 | version) | |
|
42 | raise error.Abort(_('darcs version 2.1 or newer needed (found %r)') | |
|
43 | % version) | |
|
44 | 44 | |
|
45 | 45 | if "ElementTree" not in globals(): |
|
46 |
raise |
|
|
46 | raise error.Abort(_("Python ElementTree module is not available")) | |
|
47 | 47 | |
|
48 | 48 | self.path = os.path.realpath(path) |
|
49 | 49 | |
@@ -158,7 +158,7 class darcs_source(converter_source, com | |||
|
158 | 158 | |
|
159 | 159 | def getchanges(self, rev, full): |
|
160 | 160 | if full: |
|
161 |
raise |
|
|
161 | raise error.Abort(_("convert from darcs do not support --full")) | |
|
162 | 162 | copies = {} |
|
163 | 163 | changes = [] |
|
164 | 164 | man = None |
@@ -192,7 +192,7 class darcs_source(converter_source, com | |||
|
192 | 192 | |
|
193 | 193 | def getfile(self, name, rev): |
|
194 | 194 | if rev != self.lastrev: |
|
195 |
raise |
|
|
195 | raise error.Abort(_('internal calling inconsistency')) | |
|
196 | 196 | path = os.path.join(self.tmppath, name) |
|
197 | 197 | try: |
|
198 | 198 | data = util.readfile(path) |
@@ -7,7 +7,7 | |||
|
7 | 7 | import posixpath |
|
8 | 8 | import shlex |
|
9 | 9 | from mercurial.i18n import _ |
|
10 |
from mercurial import |
|
|
10 | from mercurial import error | |
|
11 | 11 | from common import SKIPREV, converter_source |
|
12 | 12 | |
|
13 | 13 | def rpairs(path): |
@@ -45,7 +45,7 class filemapper(object): | |||
|
45 | 45 | self.targetprefixes = None |
|
46 | 46 | if path: |
|
47 | 47 | if self.parse(path): |
|
48 |
raise |
|
|
48 | raise error.Abort(_('errors in filemap')) | |
|
49 | 49 | |
|
50 | 50 | def parse(self, path): |
|
51 | 51 | errs = 0 |
@@ -291,7 +291,7 class filemap_source(converter_source): | |||
|
291 | 291 | try: |
|
292 | 292 | files = self.base.getchangedfiles(rev, i) |
|
293 | 293 | except NotImplementedError: |
|
294 |
raise |
|
|
294 | raise error.Abort(_("source repository doesn't support --filemap")) | |
|
295 | 295 | for f in files: |
|
296 | 296 | if self.filemapper(f): |
|
297 | 297 | return True |
@@ -97,7 +97,7 class convert_git(converter_source): | |||
|
97 | 97 | # The default value (50) is based on the default for 'git diff'. |
|
98 | 98 | similarity = ui.configint('convert', 'git.similarity', default=50) |
|
99 | 99 | if similarity < 0 or similarity > 100: |
|
100 |
raise |
|
|
100 | raise error.Abort(_('similarity must be between 0 and 100')) | |
|
101 | 101 | if similarity > 0: |
|
102 | 102 | self.simopt = '-C%d%%' % similarity |
|
103 | 103 | findcopiesharder = ui.configbool('convert', 'git.findcopiesharder', |
@@ -123,14 +123,14 class convert_git(converter_source): | |||
|
123 | 123 | heads, ret = self.gitread('git rev-parse --branches --remotes') |
|
124 | 124 | heads = heads.splitlines() |
|
125 | 125 | if ret: |
|
126 |
raise |
|
|
126 | raise error.Abort(_('cannot retrieve git heads')) | |
|
127 | 127 | else: |
|
128 | 128 | heads = [] |
|
129 | 129 | for rev in self.revs: |
|
130 | 130 | rawhead, ret = self.gitread("git rev-parse --verify %s" % rev) |
|
131 | 131 | heads.append(rawhead[:-1]) |
|
132 | 132 | if ret: |
|
133 |
raise |
|
|
133 | raise error.Abort(_('cannot retrieve git head "%s"') % rev) | |
|
134 | 134 | return heads |
|
135 | 135 | |
|
136 | 136 | def catfile(self, rev, type): |
@@ -140,11 +140,11 class convert_git(converter_source): | |||
|
140 | 140 | self.catfilepipe[0].flush() |
|
141 | 141 | info = self.catfilepipe[1].readline().split() |
|
142 | 142 | if info[1] != type: |
|
143 |
raise |
|
|
143 | raise error.Abort(_('cannot read %r object at %s') % (type, rev)) | |
|
144 | 144 | size = int(info[2]) |
|
145 | 145 | data = self.catfilepipe[1].read(size) |
|
146 | 146 | if len(data) < size: |
|
147 |
raise |
|
|
147 | raise error.Abort(_('cannot read %r object at %s: unexpected size') | |
|
148 | 148 | % (type, rev)) |
|
149 | 149 | # read the trailing newline |
|
150 | 150 | self.catfilepipe[1].read(1) |
@@ -210,7 +210,7 class convert_git(converter_source): | |||
|
210 | 210 | |
|
211 | 211 | def getchanges(self, version, full): |
|
212 | 212 | if full: |
|
213 |
raise |
|
|
213 | raise error.Abort(_("convert from git do not support --full")) | |
|
214 | 214 | self.modecache = {} |
|
215 | 215 | fh = self.gitopen("git diff-tree -z --root -m -r %s %s" % ( |
|
216 | 216 | self.simopt, version)) |
@@ -283,7 +283,7 class convert_git(converter_source): | |||
|
283 | 283 | copies[fdest] = f |
|
284 | 284 | entry = None |
|
285 | 285 | if fh.close(): |
|
286 |
raise |
|
|
286 | raise error.Abort(_('cannot read changes in %s') % version) | |
|
287 | 287 | |
|
288 | 288 | if subexists[0]: |
|
289 | 289 | if subdeleted[0]: |
@@ -342,13 +342,13 class convert_git(converter_source): | |||
|
342 | 342 | for line in fh: |
|
343 | 343 | line = line.strip() |
|
344 | 344 | if line.startswith("error:") or line.startswith("fatal:"): |
|
345 |
raise |
|
|
345 | raise error.Abort(_('cannot read tags from %s') % self.path) | |
|
346 | 346 | node, tag = line.split(None, 1) |
|
347 | 347 | if not tag.startswith(prefix): |
|
348 | 348 | continue |
|
349 | 349 | alltags[tag[len(prefix):]] = node |
|
350 | 350 | if fh.close(): |
|
351 |
raise |
|
|
351 | raise error.Abort(_('cannot read tags from %s') % self.path) | |
|
352 | 352 | |
|
353 | 353 | # Filter out tag objects for annotated tag refs |
|
354 | 354 | for tag in alltags: |
@@ -376,7 +376,7 class convert_git(converter_source): | |||
|
376 | 376 | '"%s^%s" --' % (version, version, i + 1)) |
|
377 | 377 | changes = [f.rstrip('\n') for f in fh] |
|
378 | 378 | if fh.close(): |
|
379 |
raise |
|
|
379 | raise error.Abort(_('cannot read changes in %s') % version) | |
|
380 | 380 | |
|
381 | 381 | return changes |
|
382 | 382 |
@@ -8,7 +8,7 | |||
|
8 | 8 | |
|
9 | 9 | from common import NoRepo, commandline, commit, converter_source |
|
10 | 10 | from mercurial.i18n import _ |
|
11 | from mercurial import encoding, util | |
|
11 | from mercurial import encoding, util, error | |
|
12 | 12 | import os, shutil, tempfile, stat |
|
13 | 13 | from email.Parser import Parser |
|
14 | 14 | |
@@ -42,7 +42,7 class gnuarch_source(converter_source, c | |||
|
42 | 42 | if util.findexe('tla'): |
|
43 | 43 | self.execmd = 'tla' |
|
44 | 44 | else: |
|
45 |
raise |
|
|
45 | raise error.Abort(_('cannot find a GNU Arch tool')) | |
|
46 | 46 | |
|
47 | 47 | commandline.__init__(self, ui, self.execmd) |
|
48 | 48 | |
@@ -135,7 +135,7 class gnuarch_source(converter_source, c | |||
|
135 | 135 | |
|
136 | 136 | def getfile(self, name, rev): |
|
137 | 137 | if rev != self.lastrev: |
|
138 |
raise |
|
|
138 | raise error.Abort(_('internal calling inconsistency')) | |
|
139 | 139 | |
|
140 | 140 | if not os.path.lexists(os.path.join(self.tmppath, name)): |
|
141 | 141 | return None, None |
@@ -144,7 +144,7 class gnuarch_source(converter_source, c | |||
|
144 | 144 | |
|
145 | 145 | def getchanges(self, rev, full): |
|
146 | 146 | if full: |
|
147 |
raise |
|
|
147 | raise error.Abort(_("convert from arch do not support --full")) | |
|
148 | 148 | self._update(rev) |
|
149 | 149 | changes = [] |
|
150 | 150 | copies = {} |
@@ -287,7 +287,7 class gnuarch_source(converter_source, c | |||
|
287 | 287 | self.changes[rev].continuationof = self.recode( |
|
288 | 288 | catlog['Continuation-of']) |
|
289 | 289 | except Exception: |
|
290 |
raise |
|
|
290 | raise error.Abort(_('could not parse cat-log of %s') % rev) | |
|
291 | 291 | |
|
292 | 292 | def _parsechangeset(self, data, rev): |
|
293 | 293 | for l in data: |
@@ -205,7 +205,7 class mercurial_sink(converter_sink): | |||
|
205 | 205 | # If the file requires actual merging, abort. We don't have enough |
|
206 | 206 | # context to resolve merges correctly. |
|
207 | 207 | if action in ['m', 'dm', 'cd', 'dc']: |
|
208 |
raise |
|
|
208 | raise error.Abort(_("unable to convert merge commit " | |
|
209 | 209 | "since target parents do not merge cleanly (file " |
|
210 | 210 | "%s, parents %s and %s)") % (file, p1ctx, |
|
211 | 211 | p2ctx)) |
@@ -423,7 +423,7 class mercurial_sink(converter_sink): | |||
|
423 | 423 | |
|
424 | 424 | def hascommitforsplicemap(self, rev): |
|
425 | 425 | if rev not in self.repo and self.clonebranches: |
|
426 |
raise |
|
|
426 | raise error.Abort(_('revision %s not found in destination ' | |
|
427 | 427 | 'repository (lookups with clonebranches=true ' |
|
428 | 428 | 'are not implemented)') % rev) |
|
429 | 429 | return rev in self.repo |
@@ -455,7 +455,7 class mercurial_source(converter_source) | |||
|
455 | 455 | try: |
|
456 | 456 | startnode = self.repo.lookup(startnode) |
|
457 | 457 | except error.RepoError: |
|
458 |
raise |
|
|
458 | raise error.Abort(_('%s is not a valid start revision') | |
|
459 | 459 | % startnode) |
|
460 | 460 | startrev = self.repo.changelog.rev(startnode) |
|
461 | 461 | children = {startnode: 1} |
@@ -470,7 +470,7 class mercurial_source(converter_source) | |||
|
470 | 470 | self._heads = self.repo.heads() |
|
471 | 471 | else: |
|
472 | 472 | if revs or startnode is not None: |
|
473 |
raise |
|
|
473 | raise error.Abort(_('hg.revs cannot be combined with ' | |
|
474 | 474 | 'hg.startrev or --rev')) |
|
475 | 475 | nodes = set() |
|
476 | 476 | parents = set() |
@@ -7,7 +7,7 | |||
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | import os, re |
|
10 | from mercurial import util | |
|
10 | from mercurial import util, error | |
|
11 | 11 | from common import NoRepo, commit, converter_source, checktool |
|
12 | 12 | from common import commandline |
|
13 | 13 | from mercurial.i18n import _ |
@@ -16,7 +16,7 class monotone_source(converter_source, | |||
|
16 | 16 | def __init__(self, ui, path=None, revs=None): |
|
17 | 17 | converter_source.__init__(self, ui, path, revs) |
|
18 | 18 | if revs and len(revs) > 1: |
|
19 |
raise |
|
|
19 | raise error.Abort(_('monotone source does not support specifying ' | |
|
20 | 20 | 'multiple revs')) |
|
21 | 21 | commandline.__init__(self, ui, 'mtn') |
|
22 | 22 | |
@@ -110,34 +110,34 class monotone_source(converter_source, | |||
|
110 | 110 | while read != ':': |
|
111 | 111 | read = self.mtnreadfp.read(1) |
|
112 | 112 | if not read: |
|
113 |
raise |
|
|
113 | raise error.Abort(_('bad mtn packet - no end of commandnbr')) | |
|
114 | 114 | commandnbr += read |
|
115 | 115 | commandnbr = commandnbr[:-1] |
|
116 | 116 | |
|
117 | 117 | stream = self.mtnreadfp.read(1) |
|
118 | 118 | if stream not in 'mewptl': |
|
119 |
raise |
|
|
119 | raise error.Abort(_('bad mtn packet - bad stream type %s') % stream) | |
|
120 | 120 | |
|
121 | 121 | read = self.mtnreadfp.read(1) |
|
122 | 122 | if read != ':': |
|
123 |
raise |
|
|
123 | raise error.Abort(_('bad mtn packet - no divider before size')) | |
|
124 | 124 | |
|
125 | 125 | read = None |
|
126 | 126 | lengthstr = '' |
|
127 | 127 | while read != ':': |
|
128 | 128 | read = self.mtnreadfp.read(1) |
|
129 | 129 | if not read: |
|
130 |
raise |
|
|
130 | raise error.Abort(_('bad mtn packet - no end of packet size')) | |
|
131 | 131 | lengthstr += read |
|
132 | 132 | try: |
|
133 | 133 | length = long(lengthstr[:-1]) |
|
134 | 134 | except TypeError: |
|
135 |
raise |
|
|
135 | raise error.Abort(_('bad mtn packet - bad packet size %s') | |
|
136 | 136 | % lengthstr) |
|
137 | 137 | |
|
138 | 138 | read = self.mtnreadfp.read(length) |
|
139 | 139 | if len(read) != length: |
|
140 |
raise |
|
|
140 | raise error.Abort(_("bad mtn packet - unable to read full packet " | |
|
141 | 141 | "read %s of %s") % (len(read), length)) |
|
142 | 142 | |
|
143 | 143 | return (commandnbr, stream, length, read) |
@@ -152,7 +152,7 class monotone_source(converter_source, | |||
|
152 | 152 | if stream == 'l': |
|
153 | 153 | # End of command |
|
154 | 154 | if output != '0': |
|
155 |
raise |
|
|
155 | raise error.Abort(_("mtn command '%s' returned %s") % | |
|
156 | 156 | (command, output)) |
|
157 | 157 | break |
|
158 | 158 | elif stream in 'ew': |
@@ -229,7 +229,7 class monotone_source(converter_source, | |||
|
229 | 229 | |
|
230 | 230 | def getchanges(self, rev, full): |
|
231 | 231 | if full: |
|
232 |
raise |
|
|
232 | raise error.Abort(_("convert from monotone do not support --full")) | |
|
233 | 233 | revision = self.mtnrun("get_revision", rev).split("\n\n") |
|
234 | 234 | files = {} |
|
235 | 235 | ignoremove = {} |
@@ -330,7 +330,7 class monotone_source(converter_source, | |||
|
330 | 330 | versionstr = self.mtnrunsingle("interface_version") |
|
331 | 331 | version = float(versionstr) |
|
332 | 332 | except Exception: |
|
333 |
raise |
|
|
333 | raise error.Abort(_("unable to determine mtn automate interface " | |
|
334 | 334 | "version")) |
|
335 | 335 | |
|
336 | 336 | if version >= 12.0: |
@@ -344,12 +344,12 class monotone_source(converter_source, | |||
|
344 | 344 | # read the headers |
|
345 | 345 | read = self.mtnreadfp.readline() |
|
346 | 346 | if read != 'format-version: 2\n': |
|
347 |
raise |
|
|
347 | raise error.Abort(_('mtn automate stdio header unexpected: %s') | |
|
348 | 348 | % read) |
|
349 | 349 | while read != '\n': |
|
350 | 350 | read = self.mtnreadfp.readline() |
|
351 | 351 | if not read: |
|
352 |
raise |
|
|
352 | raise error.Abort(_("failed to reach end of mtn automate " | |
|
353 | 353 | "stdio headers")) |
|
354 | 354 | else: |
|
355 | 355 | self.ui.debug("mtn automate version %s - not using automate stdio " |
@@ -5,7 +5,7 | |||
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | from mercurial import util | |
|
8 | from mercurial import util, error | |
|
9 | 9 | from mercurial.i18n import _ |
|
10 | 10 | |
|
11 | 11 | from common import commit, converter_source, checktool, NoRepo |
@@ -70,7 +70,7 class p4_source(converter_source): | |||
|
70 | 70 | self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$") |
|
71 | 71 | |
|
72 | 72 | if revs and len(revs) > 1: |
|
73 |
raise |
|
|
73 | raise error.Abort(_("p4 source does not support specifying " | |
|
74 | 74 | "multiple revisions")) |
|
75 | 75 | self._parse(ui, path) |
|
76 | 76 | |
@@ -277,7 +277,7 class p4_source(converter_source): | |||
|
277 | 277 | |
|
278 | 278 | def getchanges(self, rev, full): |
|
279 | 279 | if full: |
|
280 |
raise |
|
|
280 | raise error.Abort(_("convert from p4 do not support --full")) | |
|
281 | 281 | return self.files[rev], self.copies[rev], set() |
|
282 | 282 | |
|
283 | 283 | def getcommit(self, rev): |
@@ -6,7 +6,7 import os, re, sys, tempfile, urllib, ur | |||
|
6 | 6 | import xml.dom.minidom |
|
7 | 7 | import cPickle as pickle |
|
8 | 8 | |
|
9 | from mercurial import strutil, scmutil, util, encoding | |
|
9 | from mercurial import strutil, scmutil, util, encoding, error | |
|
10 | 10 | from mercurial.i18n import _ |
|
11 | 11 | |
|
12 | 12 | propertycache = util.propertycache |
@@ -141,7 +141,7 def debugsvnlog(ui, **opts): | |||
|
141 | 141 | avoid memory collection issues. |
|
142 | 142 | """ |
|
143 | 143 | if svn is None: |
|
144 |
raise |
|
|
144 | raise error.Abort(_('debugsvnlog could not load Subversion python ' | |
|
145 | 145 | 'bindings')) |
|
146 | 146 | |
|
147 | 147 | util.setbinary(sys.stdin) |
@@ -159,14 +159,14 class logstream(object): | |||
|
159 | 159 | try: |
|
160 | 160 | entry = pickle.load(self._stdout) |
|
161 | 161 | except EOFError: |
|
162 |
raise |
|
|
162 | raise error.Abort(_('Mercurial failed to run itself, check' | |
|
163 | 163 | ' hg executable is in PATH')) |
|
164 | 164 | try: |
|
165 | 165 | orig_paths, revnum, author, date, message = entry |
|
166 | 166 | except (TypeError, ValueError): |
|
167 | 167 | if entry is None: |
|
168 | 168 | break |
|
169 |
raise |
|
|
169 | raise error.Abort(_("log stream exception '%s'") % entry) | |
|
170 | 170 | yield entry |
|
171 | 171 | |
|
172 | 172 | def close(self): |
@@ -327,12 +327,12 class svn_source(converter_source): | |||
|
327 | 327 | |
|
328 | 328 | if revs: |
|
329 | 329 | if len(revs) > 1: |
|
330 |
raise |
|
|
330 | raise error.Abort(_('subversion source does not support ' | |
|
331 | 331 | 'specifying multiple revisions')) |
|
332 | 332 | try: |
|
333 | 333 | latest = int(revs[0]) |
|
334 | 334 | except ValueError: |
|
335 |
raise |
|
|
335 | raise error.Abort(_('svn: revision %s is not an integer') % | |
|
336 | 336 | revs[0]) |
|
337 | 337 | |
|
338 | 338 | self.trunkname = self.ui.config('convert', 'svn.trunk', |
@@ -343,7 +343,7 class svn_source(converter_source): | |||
|
343 | 343 | if self.startrev < 0: |
|
344 | 344 | self.startrev = 0 |
|
345 | 345 | except ValueError: |
|
346 |
raise |
|
|
346 | raise error.Abort(_('svn: start revision %s is not an integer') | |
|
347 | 347 | % self.startrev) |
|
348 | 348 | |
|
349 | 349 | try: |
@@ -351,7 +351,7 class svn_source(converter_source): | |||
|
351 | 351 | except SvnPathNotFound: |
|
352 | 352 | self.head = None |
|
353 | 353 | if not self.head: |
|
354 |
raise |
|
|
354 | raise error.Abort(_('no revision found in module %s') | |
|
355 | 355 | % self.module) |
|
356 | 356 | self.last_changed = self.revnum(self.head) |
|
357 | 357 | |
@@ -396,8 +396,8 class svn_source(converter_source): | |||
|
396 | 396 | # we are converting from inside this directory |
|
397 | 397 | return None |
|
398 | 398 | if cfgpath: |
|
399 |
raise |
|
|
400 | % (name, path)) | |
|
399 | raise error.Abort(_('expected %s to be at %r, but not found' | |
|
400 | ) % (name, path)) | |
|
401 | 401 | return None |
|
402 | 402 | self.ui.note(_('found %s at %r\n') % (name, path)) |
|
403 | 403 | return path |
@@ -415,7 +415,7 class svn_source(converter_source): | |||
|
415 | 415 | self.module += '/' + trunk |
|
416 | 416 | self.head = self.latest(self.module, self.last_changed) |
|
417 | 417 | if not self.head: |
|
418 |
raise |
|
|
418 | raise error.Abort(_('no revision found in module %s') | |
|
419 | 419 | % self.module) |
|
420 | 420 | |
|
421 | 421 | # First head in the list is the module's head |
@@ -442,11 +442,11 class svn_source(converter_source): | |||
|
442 | 442 | |
|
443 | 443 | if self.startrev and self.heads: |
|
444 | 444 | if len(self.heads) > 1: |
|
445 |
raise |
|
|
445 | raise error.Abort(_('svn: start revision is not supported ' | |
|
446 | 446 | 'with more than one branch')) |
|
447 | 447 | revnum = self.revnum(self.heads[0]) |
|
448 | 448 | if revnum < self.startrev: |
|
449 |
raise |
|
|
449 | raise error.Abort( | |
|
450 | 450 | _('svn: no revision found after start revision %d') |
|
451 | 451 | % self.startrev) |
|
452 | 452 | |
@@ -502,7 +502,7 class svn_source(converter_source): | |||
|
502 | 502 | stop = revnum + 1 |
|
503 | 503 | self._fetch_revisions(revnum, stop) |
|
504 | 504 | if rev not in self.commits: |
|
505 |
raise |
|
|
505 | raise error.Abort(_('svn: revision %s not found') % revnum) | |
|
506 | 506 | revcommit = self.commits[rev] |
|
507 | 507 | # caller caches the result, so free it here to release memory |
|
508 | 508 | del self.commits[rev] |
@@ -513,7 +513,7 class svn_source(converter_source): | |||
|
513 | 513 | if not re.match(r'svn:[0-9a-f]{8,8}-[0-9a-f]{4,4}-' |
|
514 | 514 | '[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]' |
|
515 | 515 | '{12,12}(.*)\@[0-9]+$',revstr): |
|
516 |
raise |
|
|
516 | raise error.Abort(_('%s entry %s is not a valid revision' | |
|
517 | 517 | ' identifier') % (mapname, revstr)) |
|
518 | 518 | |
|
519 | 519 | def numcommits(self): |
@@ -951,7 +951,7 class svn_source(converter_source): | |||
|
951 | 951 | except SubversionException as xxx_todo_changeme: |
|
952 | 952 | (inst, num) = xxx_todo_changeme.args |
|
953 | 953 | if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION: |
|
954 |
raise |
|
|
954 | raise error.Abort(_('svn: branch has no revision %s') | |
|
955 | 955 | % to_revnum) |
|
956 | 956 | raise |
|
957 | 957 | |
@@ -1052,7 +1052,7 class svn_source(converter_source): | |||
|
1052 | 1052 | try: |
|
1053 | 1053 | stdin.close() |
|
1054 | 1054 | except IOError: |
|
1055 |
raise |
|
|
1055 | raise error.Abort(_('Mercurial failed to run itself, check' | |
|
1056 | 1056 | ' hg executable is in PATH')) |
|
1057 | 1057 | return logstream(stdout) |
|
1058 | 1058 | |
@@ -1302,7 +1302,7 class svn_sink(converter_sink, commandli | |||
|
1302 | 1302 | return parents[0] |
|
1303 | 1303 | self.ui.warn(_('unexpected svn output:\n')) |
|
1304 | 1304 | self.ui.warn(output) |
|
1305 |
raise |
|
|
1305 | raise error.Abort(_('unable to cope with svn output')) | |
|
1306 | 1306 | if commit.rev: |
|
1307 | 1307 | self.run('propset', 'hg:convert-rev', commit.rev, |
|
1308 | 1308 | revprop=True, revision=rev) |
@@ -1329,6 +1329,6 class svn_sink(converter_sink, commandli | |||
|
1329 | 1329 | # repository and childmap would not list all revisions. Too bad. |
|
1330 | 1330 | if rev in self.childmap: |
|
1331 | 1331 | return True |
|
1332 |
raise |
|
|
1332 | raise error.Abort(_('splice map revision %s not found in subversion ' | |
|
1333 | 1333 | 'child map (revision lookups are not implemented)') |
|
1334 | 1334 | % rev) |
@@ -247,7 +247,7 def _checkhook(ui, repo, node, headsonly | |||
|
247 | 247 | for node, target, f in failed: |
|
248 | 248 | msgs.append(_(" %s in %s should not have %s line endings") % |
|
249 | 249 | (f, node, eols[target])) |
|
250 |
raise |
|
|
250 | raise error.Abort(_("end-of-line check failed:\n") + "\n".join(msgs)) | |
|
251 | 251 | |
|
252 | 252 | def checkallhook(ui, repo, node, hooktype, **kwargs): |
|
253 | 253 | """verify that files have expected EOLs""" |
@@ -347,7 +347,7 def reposetup(ui, repo): | |||
|
347 | 347 | # have all non-binary files taken care of. |
|
348 | 348 | continue |
|
349 | 349 | if inconsistenteol(data): |
|
350 |
raise |
|
|
350 | raise error.Abort(_("inconsistent newline style " | |
|
351 | 351 | "in %s\n") % f) |
|
352 | 352 | return super(eolrepo, self).commitctx(ctx, haserror) |
|
353 | 353 | repo.__class__ = eolrepo |
@@ -63,7 +63,7 pretty fast (at least faster than having | |||
|
63 | 63 | from mercurial.i18n import _ |
|
64 | 64 | from mercurial.node import short, nullid |
|
65 | 65 | from mercurial import cmdutil, scmutil, util, commands, encoding, filemerge |
|
66 | from mercurial import archival | |
|
66 | from mercurial import archival, error | |
|
67 | 67 | import os, shlex, shutil, tempfile, re |
|
68 | 68 | |
|
69 | 69 | cmdtable = {} |
@@ -127,7 +127,7 def dodiff(ui, repo, cmdline, pats, opts | |||
|
127 | 127 | |
|
128 | 128 | if revs and change: |
|
129 | 129 | msg = _('cannot specify --rev and --change at the same time') |
|
130 |
raise |
|
|
130 | raise error.Abort(msg) | |
|
131 | 131 | elif change: |
|
132 | 132 | node2 = scmutil.revsingle(repo, change, None).node() |
|
133 | 133 | node1a, node1b = repo.changelog.parents(node2) |
@@ -149,9 +149,9 def dodiff(ui, repo, cmdline, pats, opts | |||
|
149 | 149 | |
|
150 | 150 | if opts.get('patch'): |
|
151 | 151 | if subrepos: |
|
152 |
raise |
|
|
152 | raise error.Abort(_('--patch cannot be used with --subrepos')) | |
|
153 | 153 | if node2 is None: |
|
154 |
raise |
|
|
154 | raise error.Abort(_('--patch requires two revisions')) | |
|
155 | 155 | else: |
|
156 | 156 | mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher, |
|
157 | 157 | listsubrepos=subrepos)[:3]) |
@@ -47,7 +47,7 service entry controls the service name | |||
|
47 | 47 | |
|
48 | 48 | from mercurial.i18n import _ |
|
49 | 49 | from mercurial.url import passwordmgr |
|
50 |
from mercurial import httpconnection, |
|
|
50 | from mercurial import httpconnection, error | |
|
51 | 51 | import os, urllib2 |
|
52 | 52 | |
|
53 | 53 | ERRMAX = 128 |
@@ -56,7 +56,7 ERRMAX = 128 | |||
|
56 | 56 | |
|
57 | 57 | def auth_getkey(self, params): |
|
58 | 58 | if not self.ui.interactive(): |
|
59 |
raise |
|
|
59 | raise error.Abort(_('factotum not interactive')) | |
|
60 | 60 | if 'user=' not in params: |
|
61 | 61 | params = '%s user?' % params |
|
62 | 62 | params = '%s !password?' % params |
@@ -77,10 +77,10 def auth_getuserpasswd(self, getkey, par | |||
|
77 | 77 | if passwd.endswith("'"): |
|
78 | 78 | passwd = passwd[1:-1].replace("''", "'") |
|
79 | 79 | else: |
|
80 |
raise |
|
|
80 | raise error.Abort(_('malformed password string')) | |
|
81 | 81 | return (user, passwd) |
|
82 | 82 | except (OSError, IOError): |
|
83 |
raise |
|
|
83 | raise error.Abort(_('factotum not responding')) | |
|
84 | 84 | finally: |
|
85 | 85 | os.close(fd) |
|
86 | 86 | getkey(self, params) |
@@ -60,7 +60,7 def fetch(ui, repo, source='default', ** | |||
|
60 | 60 | except error.RepoLookupError: |
|
61 | 61 | branchnode = None |
|
62 | 62 | if parent != branchnode: |
|
63 |
raise |
|
|
63 | raise error.Abort(_('working directory not at branch tip'), | |
|
64 | 64 | hint=_('use "hg update" to check out branch tip')) |
|
65 | 65 | |
|
66 | 66 | wlock = lock = None |
@@ -73,7 +73,7 def fetch(ui, repo, source='default', ** | |||
|
73 | 73 | bheads = repo.branchheads(branch) |
|
74 | 74 | bheads = [head for head in bheads if len(repo[head].children()) == 0] |
|
75 | 75 | if len(bheads) > 1: |
|
76 |
raise |
|
|
76 | raise error.Abort(_('multiple heads in this branch ' | |
|
77 | 77 | '(use "hg heads ." and "hg merge" to merge)')) |
|
78 | 78 | |
|
79 | 79 | other = hg.peer(repo, opts, ui.expandpath(source)) |
@@ -86,7 +86,7 def fetch(ui, repo, source='default', ** | |||
|
86 | 86 | except error.CapabilityError: |
|
87 | 87 | err = _("other repository doesn't support revision lookup, " |
|
88 | 88 | "so a rev cannot be specified.") |
|
89 |
raise |
|
|
89 | raise error.Abort(err) | |
|
90 | 90 | |
|
91 | 91 | # Are there any changes at all? |
|
92 | 92 | modheads = exchange.pull(repo, other, heads=revs).cgresult |
@@ -6,7 +6,7 | |||
|
6 | 6 | '''commands to sign and verify changesets''' |
|
7 | 7 | |
|
8 | 8 | import os, tempfile, binascii |
|
9 | from mercurial import util, commands, match, cmdutil | |
|
9 | from mercurial import util, commands, match, cmdutil, error | |
|
10 | 10 | from mercurial import node as hgnode |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | 12 | |
@@ -237,7 +237,7 def sign(ui, repo, *revs, **opts): | |||
|
237 | 237 | nodes = [node for node in repo.dirstate.parents() |
|
238 | 238 | if node != hgnode.nullid] |
|
239 | 239 | if len(nodes) > 1: |
|
240 |
raise |
|
|
240 | raise error.Abort(_('uncommitted merge - please provide a ' | |
|
241 | 241 | 'specific revision')) |
|
242 | 242 | if not nodes: |
|
243 | 243 | nodes = [repo.changelog.tip()] |
@@ -250,7 +250,7 def sign(ui, repo, *revs, **opts): | |||
|
250 | 250 | data = node2txt(repo, n, sigver) |
|
251 | 251 | sig = mygpg.sign(data) |
|
252 | 252 | if not sig: |
|
253 |
raise |
|
|
253 | raise error.Abort(_("error while signing")) | |
|
254 | 254 | sig = binascii.b2a_base64(sig) |
|
255 | 255 | sig = sig.replace("\n", "") |
|
256 | 256 | sigmessage += "%s %s %s\n" % (hexnode, sigver, sig) |
@@ -263,7 +263,7 def sign(ui, repo, *revs, **opts): | |||
|
263 | 263 | if not opts["force"]: |
|
264 | 264 | msigs = match.exact(repo.root, '', ['.hgsigs']) |
|
265 | 265 | if any(repo.status(match=msigs, unknown=True, ignored=True)): |
|
266 |
raise |
|
|
266 | raise error.Abort(_("working copy of .hgsigs is changed "), | |
|
267 | 267 | hint=_("please commit .hgsigs manually")) |
|
268 | 268 | |
|
269 | 269 | sigsfile = repo.wfile(".hgsigs", "ab") |
@@ -287,7 +287,7 def sign(ui, repo, *revs, **opts): | |||
|
287 | 287 | repo.commit(message, opts['user'], opts['date'], match=msigs, |
|
288 | 288 | editor=editor) |
|
289 | 289 | except ValueError as inst: |
|
290 |
raise |
|
|
290 | raise error.Abort(str(inst)) | |
|
291 | 291 | |
|
292 | 292 | def shortkey(ui, key): |
|
293 | 293 | if len(key) != 16: |
@@ -301,4 +301,4 def node2txt(repo, node, ver): | |||
|
301 | 301 | if ver == "0": |
|
302 | 302 | return "%s\n" % hgnode.hex(node) |
|
303 | 303 | else: |
|
304 |
raise |
|
|
304 | raise error.Abort(_("unknown signature version")) |
@@ -43,7 +43,7 configure it, set the following options | |||
|
43 | 43 | |
|
44 | 44 | from mercurial.i18n import _ |
|
45 | 45 | from mercurial.node import bin, short |
|
46 | from mercurial import cmdutil, patch, util, mail | |
|
46 | from mercurial import cmdutil, patch, util, mail, error | |
|
47 | 47 | import email.Parser |
|
48 | 48 | |
|
49 | 49 | import socket, xmlrpclib |
@@ -233,7 +233,7 class hgcia(object): | |||
|
233 | 233 | srv = xmlrpclib.Server(self.ciaurl) |
|
234 | 234 | res = srv.hub.deliver(msg) |
|
235 | 235 | if res is not True and res != 'queued.': |
|
236 |
raise |
|
|
236 | raise error.Abort(_('%s returned an error: %s') % | |
|
237 | 237 | (self.ciaurl, res)) |
|
238 | 238 | |
|
239 | 239 | def sendemail(self, address, data): |
@@ -259,7 +259,7 def hook(ui, repo, hooktype, node=None, | |||
|
259 | 259 | ui.write(msg) |
|
260 | 260 | elif cia.ciaurl.startswith('mailto:'): |
|
261 | 261 | if not cia.emailfrom: |
|
262 |
raise |
|
|
262 | raise error.Abort(_('email.from must be defined when ' | |
|
263 | 263 | 'sending by email')) |
|
264 | 264 | cia.sendemail(cia.ciaurl[7:], msg) |
|
265 | 265 | else: |
@@ -225,7 +225,7 class histeditstate(object): | |||
|
225 | 225 | except IOError as err: |
|
226 | 226 | if err.errno != errno.ENOENT: |
|
227 | 227 | raise |
|
228 |
raise |
|
|
228 | raise error.Abort(_('no histedit in progress')) | |
|
229 | 229 | |
|
230 | 230 | try: |
|
231 | 231 | data = pickle.load(fp) |
@@ -331,7 +331,7 class histeditaction(object): | |||
|
331 | 331 | try: |
|
332 | 332 | node = repo[rulehash].node() |
|
333 | 333 | except error.RepoError: |
|
334 |
raise |
|
|
334 | raise error.Abort(_('unknown changeset %s listed') % rulehash[:12]) | |
|
335 | 335 | return cls(state, node) |
|
336 | 336 | |
|
337 | 337 | def run(self): |
@@ -439,7 +439,7 def collapse(repo, first, last, commitop | |||
|
439 | 439 | return None |
|
440 | 440 | for c in ctxs: |
|
441 | 441 | if not c.mutable(): |
|
442 |
raise |
|
|
442 | raise error.Abort( | |
|
443 | 443 | _("cannot fold into public change %s") % node.short(c.node())) |
|
444 | 444 | base = first.parents()[0] |
|
445 | 445 | |
@@ -664,12 +664,12 def findoutgoing(ui, repo, remote=None, | |||
|
664 | 664 | |
|
665 | 665 | outgoing = discovery.findcommonoutgoing(repo, other, revs, force=force) |
|
666 | 666 | if not outgoing.missing: |
|
667 |
raise |
|
|
667 | raise error.Abort(_('no outgoing ancestors')) | |
|
668 | 668 | roots = list(repo.revs("roots(%ln)", outgoing.missing)) |
|
669 | 669 | if 1 < len(roots): |
|
670 | 670 | msg = _('there are ambiguous outgoing revisions') |
|
671 | 671 | hint = _('see "hg help histedit" for more detail') |
|
672 |
raise |
|
|
672 | raise error.Abort(msg, hint=hint) | |
|
673 | 673 | return repo.lookup(roots[0]) |
|
674 | 674 | |
|
675 | 675 | actiontable = {'p': pick, |
@@ -736,7 +736,7 def _histedit(ui, repo, state, *freeargs | |||
|
736 | 736 | # blanket if mq patches are applied somewhere |
|
737 | 737 | mq = getattr(repo, 'mq', None) |
|
738 | 738 | if mq and mq.applied: |
|
739 |
raise |
|
|
739 | raise error.Abort(_('source has mq patches applied')) | |
|
740 | 740 | |
|
741 | 741 | # basic argument incompatibility processing |
|
742 | 742 | outg = opts.get('outgoing') |
@@ -748,29 +748,29 def _histedit(ui, repo, state, *freeargs | |||
|
748 | 748 | revs = opts.get('rev', []) |
|
749 | 749 | goal = 'new' # This invocation goal, in new, continue, abort |
|
750 | 750 | if force and not outg: |
|
751 |
raise |
|
|
751 | raise error.Abort(_('--force only allowed with --outgoing')) | |
|
752 | 752 | if cont: |
|
753 | 753 | if any((outg, abort, revs, freeargs, rules, editplan)): |
|
754 |
raise |
|
|
754 | raise error.Abort(_('no arguments allowed with --continue')) | |
|
755 | 755 | goal = 'continue' |
|
756 | 756 | elif abort: |
|
757 | 757 | if any((outg, revs, freeargs, rules, editplan)): |
|
758 |
raise |
|
|
758 | raise error.Abort(_('no arguments allowed with --abort')) | |
|
759 | 759 | goal = 'abort' |
|
760 | 760 | elif editplan: |
|
761 | 761 | if any((outg, revs, freeargs)): |
|
762 |
raise |
|
|
762 | raise error.Abort(_('only --commands argument allowed with ' | |
|
763 | 763 | '--edit-plan')) |
|
764 | 764 | goal = 'edit-plan' |
|
765 | 765 | else: |
|
766 | 766 | if os.path.exists(os.path.join(repo.path, 'histedit-state')): |
|
767 |
raise |
|
|
767 | raise error.Abort(_('history edit already in progress, try ' | |
|
768 | 768 | '--continue or --abort')) |
|
769 | 769 | if outg: |
|
770 | 770 | if revs: |
|
771 |
raise |
|
|
771 | raise error.Abort(_('no revisions allowed with --outgoing')) | |
|
772 | 772 | if len(freeargs) > 1: |
|
773 |
raise |
|
|
773 | raise error.Abort( | |
|
774 | 774 | _('only one repo argument allowed with --outgoing')) |
|
775 | 775 | else: |
|
776 | 776 | revs.extend(freeargs) |
@@ -780,7 +780,7 def _histedit(ui, repo, state, *freeargs | |||
|
780 | 780 | if histeditdefault: |
|
781 | 781 | revs.append(histeditdefault) |
|
782 | 782 | if len(revs) != 1: |
|
783 |
raise |
|
|
783 | raise error.Abort( | |
|
784 | 784 | _('histedit requires exactly one ancestor revision')) |
|
785 | 785 | |
|
786 | 786 | |
@@ -856,13 +856,13 def _histedit(ui, repo, state, *freeargs | |||
|
856 | 856 | else: |
|
857 | 857 | rr = list(repo.set('roots(%ld)', scmutil.revrange(repo, revs))) |
|
858 | 858 | if len(rr) != 1: |
|
859 |
raise |
|
|
859 | raise error.Abort(_('The specified revisions must have ' | |
|
860 | 860 | 'exactly one common root')) |
|
861 | 861 | root = rr[0].node() |
|
862 | 862 | |
|
863 | 863 | revs = between(repo, root, topmost, state.keep) |
|
864 | 864 | if not revs: |
|
865 |
raise |
|
|
865 | raise error.Abort(_('%s is not an ancestor of working directory') % | |
|
866 | 866 | node.short(root)) |
|
867 | 867 | |
|
868 | 868 | ctxs = [repo[r] for r in revs] |
@@ -960,7 +960,7 def bootstrapcontinue(ui, state, opts): | |||
|
960 | 960 | actobj.continuedirty() |
|
961 | 961 | s = repo.status() |
|
962 | 962 | if s.modified or s.added or s.removed or s.deleted: |
|
963 |
raise |
|
|
963 | raise error.Abort(_("working copy still dirty")) | |
|
964 | 964 | |
|
965 | 965 | parentctx, replacements = actobj.continueclean() |
|
966 | 966 | |
@@ -977,12 +977,12 def between(repo, old, new, keep): | |||
|
977 | 977 | if ctxs and not keep: |
|
978 | 978 | if (not obsolete.isenabled(repo, obsolete.allowunstableopt) and |
|
979 | 979 | repo.revs('(%ld::) - (%ld)', ctxs, ctxs)): |
|
980 |
raise |
|
|
980 | raise error.Abort(_('cannot edit history that would orphan nodes')) | |
|
981 | 981 | if repo.revs('(%ld) and merge()', ctxs): |
|
982 |
raise |
|
|
982 | raise error.Abort(_('cannot edit history that contains merges')) | |
|
983 | 983 | root = ctxs[0] # list is already sorted by repo.set |
|
984 | 984 | if not root.mutable(): |
|
985 |
raise |
|
|
985 | raise error.Abort(_('cannot edit public changeset: %s') % root, | |
|
986 | 986 | hint=_('see "hg help phases" for details')) |
|
987 | 987 | return [c.node() for c in ctxs] |
|
988 | 988 | |
@@ -1033,26 +1033,26 def verifyrules(rules, repo, ctxs): | |||
|
1033 | 1033 | seen = set() |
|
1034 | 1034 | for r in rules: |
|
1035 | 1035 | if ' ' not in r: |
|
1036 |
raise |
|
|
1036 | raise error.Abort(_('malformed line "%s"') % r) | |
|
1037 | 1037 | action, rest = r.split(' ', 1) |
|
1038 | 1038 | ha = rest.strip().split(' ', 1)[0] |
|
1039 | 1039 | try: |
|
1040 | 1040 | ha = repo[ha].hex() |
|
1041 | 1041 | except error.RepoError: |
|
1042 |
raise |
|
|
1042 | raise error.Abort(_('unknown changeset %s listed') % ha[:12]) | |
|
1043 | 1043 | if ha not in expected: |
|
1044 |
raise |
|
|
1044 | raise error.Abort( | |
|
1045 | 1045 | _('may not use changesets other than the ones listed')) |
|
1046 | 1046 | if ha in seen: |
|
1047 |
raise |
|
|
1047 | raise error.Abort(_('duplicated command for changeset %s') % | |
|
1048 | 1048 | ha[:12]) |
|
1049 | 1049 | seen.add(ha) |
|
1050 | 1050 | if action not in actiontable or action.startswith('_'): |
|
1051 |
raise |
|
|
1051 | raise error.Abort(_('unknown action "%s"') % action) | |
|
1052 | 1052 | parsed.append([action, ha]) |
|
1053 | 1053 | missing = sorted(expected - seen) # sort to stabilize output |
|
1054 | 1054 | if missing: |
|
1055 |
raise |
|
|
1055 | raise error.Abort(_('missing rules for changeset %s') % | |
|
1056 | 1056 | missing[0][:12], |
|
1057 | 1057 | hint=_('do you want to use the drop action?')) |
|
1058 | 1058 | return parsed |
@@ -1208,7 +1208,7 def stripwrapper(orig, ui, repo, nodelis | |||
|
1208 | 1208 | strip_nodes = set([repo[n].node() for n in nodelist]) |
|
1209 | 1209 | common_nodes = histedit_nodes & strip_nodes |
|
1210 | 1210 | if common_nodes: |
|
1211 |
raise |
|
|
1211 | raise error.Abort(_("histedit in progress, can't strip %s") | |
|
1212 | 1212 | % ', '.join(node.short(x) for x in common_nodes)) |
|
1213 | 1213 | return orig(ui, repo, nodelist, *args, **kwargs) |
|
1214 | 1214 |
@@ -83,7 +83,7 like CVS' $Log$, are not supported. A ke | |||
|
83 | 83 | ''' |
|
84 | 84 | |
|
85 | 85 | from mercurial import commands, context, cmdutil, dispatch, filelog, extensions |
|
86 | from mercurial import localrepo, match, patch, templatefilters, util | |
|
86 | from mercurial import localrepo, match, patch, templatefilters, util, error | |
|
87 | 87 | from mercurial import scmutil, pathutil |
|
88 | 88 | from mercurial.hgweb import webcommands |
|
89 | 89 | from mercurial.i18n import _ |
@@ -348,20 +348,20 def _status(ui, repo, wctx, kwt, *pats, | |||
|
348 | 348 | return repo.status(match=scmutil.match(wctx, pats, opts), clean=True, |
|
349 | 349 | unknown=opts.get('unknown') or opts.get('all')) |
|
350 | 350 | if ui.configitems('keyword'): |
|
351 |
raise |
|
|
352 |
raise |
|
|
351 | raise error.Abort(_('[keyword] patterns cannot match')) | |
|
352 | raise error.Abort(_('no [keyword] patterns configured')) | |
|
353 | 353 | |
|
354 | 354 | def _kwfwrite(ui, repo, expand, *pats, **opts): |
|
355 | 355 | '''Selects files and passes them to kwtemplater.overwrite.''' |
|
356 | 356 | wctx = repo[None] |
|
357 | 357 | if len(wctx.parents()) > 1: |
|
358 |
raise |
|
|
358 | raise error.Abort(_('outstanding uncommitted merge')) | |
|
359 | 359 | kwt = kwtools['templater'] |
|
360 | 360 | wlock = repo.wlock() |
|
361 | 361 | try: |
|
362 | 362 | status = _status(ui, repo, wctx, kwt, *pats, **opts) |
|
363 | 363 | if status.modified or status.added or status.removed or status.deleted: |
|
364 |
raise |
|
|
364 | raise error.Abort(_('outstanding uncommitted changes')) | |
|
365 | 365 | kwt.overwrite(wctx, status.clean, True, expand) |
|
366 | 366 | finally: |
|
367 | 367 | wlock.release() |
@@ -10,7 +10,7 | |||
|
10 | 10 | |
|
11 | 11 | import re |
|
12 | 12 | |
|
13 | from mercurial import util, node, hg | |
|
13 | from mercurial import util, node, hg, error | |
|
14 | 14 | from mercurial.i18n import _ |
|
15 | 15 | |
|
16 | 16 | import lfutil |
@@ -209,7 +209,7 def _openstore(repo, remote=None, put=Fa | |||
|
209 | 209 | try: |
|
210 | 210 | storeproviders = _storeprovider[scheme] |
|
211 | 211 | except KeyError: |
|
212 |
raise |
|
|
212 | raise error.Abort(_('unsupported URL scheme %r') % scheme) | |
|
213 | 213 | |
|
214 | 214 | for classobj in storeproviders: |
|
215 | 215 | try: |
@@ -217,5 +217,5 def _openstore(repo, remote=None, put=Fa | |||
|
217 | 217 | except lfutil.storeprotonotcapable: |
|
218 | 218 | pass |
|
219 | 219 | |
|
220 |
raise |
|
|
220 | raise error.Abort(_('%s does not appear to be a largefile store') % | |
|
221 | 221 | util.hidepassword(path)) |
@@ -62,9 +62,9 def lfconvert(ui, src, dest, *pats, **op | |||
|
62 | 62 | size = lfutil.getminsize(ui, True, opts.get('size'), default=None) |
|
63 | 63 | |
|
64 | 64 | if not hg.islocal(src): |
|
65 |
raise |
|
|
65 | raise error.Abort(_('%s is not a local Mercurial repo') % src) | |
|
66 | 66 | if not hg.islocal(dest): |
|
67 |
raise |
|
|
67 | raise error.Abort(_('%s is not a local Mercurial repo') % dest) | |
|
68 | 68 | |
|
69 | 69 | rsrc = hg.repository(ui, src) |
|
70 | 70 | ui.status(_('initializing destination %s\n') % dest) |
@@ -139,7 +139,7 def lfconvert(ui, src, dest, *pats, **op | |||
|
139 | 139 | path = lfutil.findfile(rsrc, hash) |
|
140 | 140 | |
|
141 | 141 | if path is None: |
|
142 |
raise |
|
|
142 | raise error.Abort(_("missing largefile for '%s' in %s") | |
|
143 | 143 | % (realname, realrev)) |
|
144 | 144 | fp = open(path, 'rb') |
|
145 | 145 | |
@@ -157,7 +157,7 def lfconvert(ui, src, dest, *pats, **op | |||
|
157 | 157 | |
|
158 | 158 | found, missing = downloadlfiles(ui, rsrc) |
|
159 | 159 | if missing != 0: |
|
160 |
raise |
|
|
160 | raise error.Abort(_("all largefiles must be present locally")) | |
|
161 | 161 | |
|
162 | 162 | orig = convcmd.converter |
|
163 | 163 | convcmd.converter = converter |
@@ -196,7 +196,7 def _lfconvert_addchangeset(rsrc, rdst, | |||
|
196 | 196 | islfile |= renamedlfile |
|
197 | 197 | if 'l' in fctx.flags(): |
|
198 | 198 | if renamedlfile: |
|
199 |
raise |
|
|
199 | raise error.Abort( | |
|
200 | 200 | _('renamed/copied largefile %s becomes symlink') |
|
201 | 201 | % f) |
|
202 | 202 | islfile = False |
@@ -213,7 +213,7 def _lfconvert_addchangeset(rsrc, rdst, | |||
|
213 | 213 | if 'l' in fctx.flags(): |
|
214 | 214 | renamed = fctx.renamed() |
|
215 | 215 | if renamed and renamed[0] in lfiles: |
|
216 |
raise |
|
|
216 | raise error.Abort(_('largefile %s becomes symlink') % f) | |
|
217 | 217 | |
|
218 | 218 | # largefile was modified, update standins |
|
219 | 219 | m = util.sha1('') |
@@ -355,7 +355,7 def uploadlfiles(ui, rsrc, rdst, files): | |||
|
355 | 355 | total=len(files)) |
|
356 | 356 | source = lfutil.findfile(rsrc, hash) |
|
357 | 357 | if not source: |
|
358 |
raise |
|
|
358 | raise error.Abort(_('largefile %s missing from store' | |
|
359 | 359 | ' (needs to be uploaded)') % hash) |
|
360 | 360 | # XXX check for errors here |
|
361 | 361 | store.put(source, hash) |
@@ -539,7 +539,7 def lfpull(ui, repo, source="default", * | |||
|
539 | 539 | |
|
540 | 540 | revs = opts.get('rev', []) |
|
541 | 541 | if not revs: |
|
542 |
raise |
|
|
542 | raise error.Abort(_('no revisions specified')) | |
|
543 | 543 | revs = scmutil.revrange(repo, revs) |
|
544 | 544 | |
|
545 | 545 | numcached = 0 |
@@ -16,7 +16,7 import copy | |||
|
16 | 16 | |
|
17 | 17 | from mercurial import dirstate, httpconnection, match as match_, util, scmutil |
|
18 | 18 | from mercurial.i18n import _ |
|
19 | from mercurial import node | |
|
19 | from mercurial import node, error | |
|
20 | 20 | |
|
21 | 21 | shortname = '.hglf' |
|
22 | 22 | shortnameslash = shortname + '/' |
@@ -33,10 +33,10 def getminsize(ui, assumelfiles, opt, de | |||
|
33 | 33 | try: |
|
34 | 34 | lfsize = float(lfsize) |
|
35 | 35 | except ValueError: |
|
36 |
raise |
|
|
36 | raise error.Abort(_('largefiles: size must be number (not %s)\n') | |
|
37 | 37 | % lfsize) |
|
38 | 38 | if lfsize is None: |
|
39 |
raise |
|
|
39 | raise error.Abort(_('minimum size for largefiles must be specified')) | |
|
40 | 40 | return lfsize |
|
41 | 41 | |
|
42 | 42 | def link(src, dest): |
@@ -74,7 +74,7 def usercachepath(ui, hash): | |||
|
74 | 74 | if home: |
|
75 | 75 | path = os.path.join(home, '.cache', longname, hash) |
|
76 | 76 | else: |
|
77 |
raise |
|
|
77 | raise error.Abort(_('unknown operating system: %s\n') % os.name) | |
|
78 | 78 | return path |
|
79 | 79 | |
|
80 | 80 | def inusercache(ui, hash): |
@@ -12,7 +12,7 import os | |||
|
12 | 12 | import copy |
|
13 | 13 | |
|
14 | 14 | from mercurial import hg, util, cmdutil, scmutil, match as match_, \ |
|
15 | archival, pathutil, revset | |
|
15 | archival, pathutil, revset, error | |
|
16 | 16 | from mercurial.i18n import _ |
|
17 | 17 | |
|
18 | 18 | import lfutil |
@@ -245,7 +245,7 def decodepath(orig, path): | |||
|
245 | 245 | |
|
246 | 246 | def overrideadd(orig, ui, repo, *pats, **opts): |
|
247 | 247 | if opts.get('normal') and opts.get('large'): |
|
248 |
raise |
|
|
248 | raise error.Abort(_('--normal cannot be used with --large')) | |
|
249 | 249 | return orig(ui, repo, *pats, **opts) |
|
250 | 250 | |
|
251 | 251 | def cmdutiladd(orig, ui, repo, matcher, prefix, explicitonly, **opts): |
@@ -584,7 +584,7 def overridecopy(orig, ui, repo, pats, o | |||
|
584 | 584 | installnormalfilesmatchfn(repo[None].manifest()) |
|
585 | 585 | try: |
|
586 | 586 | result = orig(ui, repo, pats, opts, rename) |
|
587 |
except |
|
|
587 | except error.Abort as e: | |
|
588 | 588 | if str(e) != _('no files to copy'): |
|
589 | 589 | raise e |
|
590 | 590 | else: |
@@ -688,7 +688,7 def overridecopy(orig, ui, repo, pats, o | |||
|
688 | 688 | |
|
689 | 689 | lfdirstate.add(destlfile) |
|
690 | 690 | lfdirstate.write() |
|
691 |
except |
|
|
691 | except error.Abort as e: | |
|
692 | 692 | if str(e) != _('no files to copy'): |
|
693 | 693 | raise e |
|
694 | 694 | else: |
@@ -698,7 +698,7 def overridecopy(orig, ui, repo, pats, o | |||
|
698 | 698 | wlock.release() |
|
699 | 699 | |
|
700 | 700 | if nolfiles and nonormalfiles: |
|
701 |
raise |
|
|
701 | raise error.Abort(_('no files to copy')) | |
|
702 | 702 | |
|
703 | 703 | return result |
|
704 | 704 | |
@@ -827,7 +827,7 def pulledrevsetsymbol(repo, subset, x): | |||
|
827 | 827 | try: |
|
828 | 828 | firstpulled = repo.firstpulled |
|
829 | 829 | except AttributeError: |
|
830 |
raise |
|
|
830 | raise error.Abort(_("pulled() only available in --lfrev")) | |
|
831 | 831 | return revset.baseset([r for r in subset if r >= firstpulled]) |
|
832 | 832 | |
|
833 | 833 | def overrideclone(orig, ui, source, dest=None, **opts): |
@@ -835,7 +835,7 def overrideclone(orig, ui, source, dest | |||
|
835 | 835 | if d is None: |
|
836 | 836 | d = hg.defaultdest(source) |
|
837 | 837 | if opts.get('all_largefiles') and not hg.islocal(d): |
|
838 |
raise |
|
|
838 | raise error.Abort(_( | |
|
839 | 839 | '--all-largefiles is incompatible with non-local destination %s') % |
|
840 | 840 | d) |
|
841 | 841 | |
@@ -916,13 +916,13 def overridearchive(orig, repo, dest, no | |||
|
916 | 916 | lfcommands.cachelfiles(repo.ui, repo, node) |
|
917 | 917 | |
|
918 | 918 | if kind not in archival.archivers: |
|
919 |
raise |
|
|
919 | raise error.Abort(_("unknown archive type '%s'") % kind) | |
|
920 | 920 | |
|
921 | 921 | ctx = repo[node] |
|
922 | 922 | |
|
923 | 923 | if kind == 'files': |
|
924 | 924 | if prefix: |
|
925 |
raise |
|
|
925 | raise error.Abort( | |
|
926 | 926 | _('cannot give prefix when archiving to files')) |
|
927 | 927 | else: |
|
928 | 928 | prefix = archival.tidyprefix(dest, kind, prefix) |
@@ -949,7 +949,7 def overridearchive(orig, repo, dest, no | |||
|
949 | 949 | path = lfutil.findfile(repo, getdata().strip()) |
|
950 | 950 | |
|
951 | 951 | if path is None: |
|
952 |
raise |
|
|
952 | raise error.Abort( | |
|
953 | 953 | _('largefile %s not found in repo store or system cache') |
|
954 | 954 | % lfutil.splitstandin(f)) |
|
955 | 955 | else: |
@@ -1006,7 +1006,7 def hgsubrepoarchive(orig, repo, archive | |||
|
1006 | 1006 | path = lfutil.findfile(repo._repo, getdata().strip()) |
|
1007 | 1007 | |
|
1008 | 1008 | if path is None: |
|
1009 |
raise |
|
|
1009 | raise error.Abort( | |
|
1010 | 1010 | _('largefile %s not found in repo store or system cache') |
|
1011 | 1011 | % lfutil.splitstandin(f)) |
|
1012 | 1012 | else: |
@@ -1043,7 +1043,7 def overridebailifchanged(orig, repo, *a | |||
|
1043 | 1043 | s = repo.status() |
|
1044 | 1044 | repo.lfstatus = False |
|
1045 | 1045 | if s.modified or s.added or s.removed or s.deleted: |
|
1046 |
raise |
|
|
1046 | raise error.Abort(_('uncommitted changes')) | |
|
1047 | 1047 | |
|
1048 | 1048 | def cmdutilforget(orig, ui, repo, match, prefix, explicitonly): |
|
1049 | 1049 | normalmatcher = composenormalfilematcher(match, repo[None].manifest()) |
@@ -1344,7 +1344,7 def overridecat(orig, ui, repo, file1, * | |||
|
1344 | 1344 | store = basestore._openstore(repo) |
|
1345 | 1345 | success, missing = store.get([(lf, hash)]) |
|
1346 | 1346 | if len(success) != 1: |
|
1347 |
raise |
|
|
1347 | raise error.Abort( | |
|
1348 | 1348 | _('largefile %s is not in cache and could not be ' |
|
1349 | 1349 | 'downloaded') % lf) |
|
1350 | 1350 | path = lfutil.usercachepath(repo.ui, hash) |
@@ -51,7 +51,8 def getlfile(repo, proto, sha): | |||
|
51 | 51 | cache.''' |
|
52 | 52 | filename = lfutil.findfile(repo, sha) |
|
53 | 53 | if not filename: |
|
54 |
raise |
|
|
54 | raise error.Abort(_('requested largefile %s not present in cache') | |
|
55 | % sha) | |
|
55 | 56 | f = open(filename, 'rb') |
|
56 | 57 | length = os.fstat(f.fileno())[6] |
|
57 | 58 |
@@ -8,7 +8,7 | |||
|
8 | 8 | |
|
9 | 9 | import urllib2 |
|
10 | 10 | |
|
11 | from mercurial import util, wireproto | |
|
11 | from mercurial import util, wireproto, error | |
|
12 | 12 | from mercurial.i18n import _ |
|
13 | 13 | |
|
14 | 14 | import lfutil |
@@ -21,7 +21,7 class remotestore(basestore.basestore): | |||
|
21 | 21 | |
|
22 | 22 | def put(self, source, hash): |
|
23 | 23 | if self.sendfile(source, hash): |
|
24 |
raise |
|
|
24 | raise error.Abort( | |
|
25 | 25 | _('remotestore: could not put %s to remote store %s') |
|
26 | 26 | % (source, util.hidepassword(self.url))) |
|
27 | 27 | self.ui.debug( |
@@ -39,7 +39,7 class remotestore(basestore.basestore): | |||
|
39 | 39 | fd = lfutil.httpsendfile(self.ui, filename) |
|
40 | 40 | return self._put(hash, fd) |
|
41 | 41 | except IOError as e: |
|
42 |
raise |
|
|
42 | raise error.Abort( | |
|
43 | 43 | _('remotestore: could not open file %s: %s') |
|
44 | 44 | % (filename, str(e))) |
|
45 | 45 | finally: |
@@ -50,14 +50,14 class remotestore(basestore.basestore): | |||
|
50 | 50 | try: |
|
51 | 51 | chunks = self._get(hash) |
|
52 | 52 | except urllib2.HTTPError as e: |
|
53 |
# 401s get converted to |
|
|
53 | # 401s get converted to error.Aborts; everything else is fine being | |
|
54 | 54 | # turned into a StoreError |
|
55 | 55 | raise basestore.StoreError(filename, hash, self.url, str(e)) |
|
56 | 56 | except urllib2.URLError as e: |
|
57 | 57 | # This usually indicates a connection problem, so don't |
|
58 | 58 | # keep trying with the other files... they will probably |
|
59 | 59 | # all fail too. |
|
60 |
raise |
|
|
60 | raise error.Abort('%s: %s' % | |
|
61 | 61 | (util.hidepassword(self.url), e.reason)) |
|
62 | 62 | except IOError as e: |
|
63 | 63 | raise basestore.StoreError(filename, hash, self.url, str(e)) |
@@ -10,7 +10,7 | |||
|
10 | 10 | import copy |
|
11 | 11 | import os |
|
12 | 12 | |
|
13 |
from mercurial import error, match as match_, |
|
|
13 | from mercurial import error, match as match_, error | |
|
14 | 14 | from mercurial.i18n import _ |
|
15 | 15 | from mercurial import scmutil, localrepo |
|
16 | 16 | |
@@ -280,7 +280,7 def reposetup(ui, repo): | |||
|
280 | 280 | msg = _("required features are not" |
|
281 | 281 | " supported in the destination:" |
|
282 | 282 | " %s") % (', '.join(sorted(missing))) |
|
283 |
raise |
|
|
283 | raise error.Abort(msg) | |
|
284 | 284 | return super(lfilesrepo, self).push(remote, force=force, revs=revs, |
|
285 | 285 | newbranch=newbranch) |
|
286 | 286 | |
@@ -304,7 +304,7 def reposetup(ui, repo): | |||
|
304 | 304 | |
|
305 | 305 | for f in files: |
|
306 | 306 | if lfutil.isstandin(f + '/'): |
|
307 |
raise |
|
|
307 | raise error.Abort( | |
|
308 | 308 | _('file "%s" is a largefile standin') % f, |
|
309 | 309 | hint=('commit the largefile itself instead')) |
|
310 | 310 | # Scan directories |
@@ -492,7 +492,7 class queue(object): | |||
|
492 | 492 | elif self.gitmode in ('yes', 'no'): |
|
493 | 493 | diffopts.git = self.gitmode == 'yes' |
|
494 | 494 | else: |
|
495 |
raise |
|
|
495 | raise error.Abort(_('mq.git option can be auto/keep/yes/no' | |
|
496 | 496 | ' got %s') % self.gitmode) |
|
497 | 497 | if patchfn: |
|
498 | 498 | diffopts = self.patchopts(diffopts, patchfn) |
@@ -544,7 +544,7 class queue(object): | |||
|
544 | 544 | patch = patch.strip() |
|
545 | 545 | if patch: |
|
546 | 546 | if patch in self.series: |
|
547 |
raise |
|
|
547 | raise error.Abort(_('%s appears more than once in %s') % | |
|
548 | 548 | (patch, self.join(self.seriespath))) |
|
549 | 549 | self.series.append(patch) |
|
550 | 550 | self.seriesguards.append(self.guard_re.findall(comment)) |
@@ -565,7 +565,7 class queue(object): | |||
|
565 | 565 | for guard in guards: |
|
566 | 566 | bad = self.checkguard(guard) |
|
567 | 567 | if bad: |
|
568 |
raise |
|
|
568 | raise error.Abort(bad) | |
|
569 | 569 | guards = sorted(set(guards)) |
|
570 | 570 | self.ui.debug('active guards: %s\n' % ' '.join(guards)) |
|
571 | 571 | self.activeguards = guards |
@@ -592,12 +592,12 class queue(object): | |||
|
592 | 592 | def setguards(self, idx, guards): |
|
593 | 593 | for g in guards: |
|
594 | 594 | if len(g) < 2: |
|
595 |
raise |
|
|
595 | raise error.Abort(_('guard %r too short') % g) | |
|
596 | 596 | if g[0] not in '-+': |
|
597 |
raise |
|
|
597 | raise error.Abort(_('guard %r starts with invalid char') % g) | |
|
598 | 598 | bad = self.checkguard(g[1:]) |
|
599 | 599 | if bad: |
|
600 |
raise |
|
|
600 | raise error.Abort(bad) | |
|
601 | 601 | drop = self.guard_re.sub('', self.fullseries[idx]) |
|
602 | 602 | self.fullseries[idx] = drop + ''.join([' #' + g for g in guards]) |
|
603 | 603 | self.parseseries() |
@@ -708,7 +708,7 class queue(object): | |||
|
708 | 708 | return (err, n) |
|
709 | 709 | |
|
710 | 710 | if n is None: |
|
711 |
raise |
|
|
711 | raise error.Abort(_("apply failed for patch %s") % patch) | |
|
712 | 712 | |
|
713 | 713 | self.ui.warn(_("patch didn't work out, merging %s\n") % patch) |
|
714 | 714 | |
@@ -719,14 +719,14 class queue(object): | |||
|
719 | 719 | ctx = repo[rev] |
|
720 | 720 | ret = hg.merge(repo, rev) |
|
721 | 721 | if ret: |
|
722 |
raise |
|
|
722 | raise error.Abort(_("update returned %d") % ret) | |
|
723 | 723 | n = newcommit(repo, None, ctx.description(), ctx.user(), force=True) |
|
724 | 724 | if n is None: |
|
725 |
raise |
|
|
725 | raise error.Abort(_("repo commit failed")) | |
|
726 | 726 | try: |
|
727 | 727 | ph = patchheader(mergeq.join(patch), self.plainmode) |
|
728 | 728 | except Exception: |
|
729 |
raise |
|
|
729 | raise error.Abort(_("unable to read %s") % patch) | |
|
730 | 730 | |
|
731 | 731 | diffopts = self.patchopts(diffopts, patch) |
|
732 | 732 | patchf = self.opener(patch, "w") |
@@ -931,9 +931,9 class queue(object): | |||
|
931 | 931 | n = newcommit(repo, None, message, ph.user, ph.date, match=match, |
|
932 | 932 | force=True) |
|
933 | 933 | if repo['tip'] == oldtip: |
|
934 |
raise |
|
|
934 | raise error.Abort(_("qpush exactly duplicates child changeset")) | |
|
935 | 935 | if n is None: |
|
936 |
raise |
|
|
936 | raise error.Abort(_("repository commit failed")) | |
|
937 | 937 | |
|
938 | 938 | if update_status: |
|
939 | 939 | self.applied.append(statusentry(n, patchname)) |
@@ -985,7 +985,7 class queue(object): | |||
|
985 | 985 | self.ui.warn(msg % (short(rev[p]), p)) |
|
986 | 986 | else: |
|
987 | 987 | msg = _('unknown patches: %s\n') |
|
988 |
raise |
|
|
988 | raise error.Abort(''.join(msg % p for p in unknown)) | |
|
989 | 989 | |
|
990 | 990 | self.parseseries() |
|
991 | 991 | self.seriesdirty = True |
@@ -997,13 +997,13 class queue(object): | |||
|
997 | 997 | for i, rev in enumerate(revs): |
|
998 | 998 | |
|
999 | 999 | if rev < firstrev: |
|
1000 |
raise |
|
|
1000 | raise error.Abort(_('revision %d is not managed') % rev) | |
|
1001 | 1001 | |
|
1002 | 1002 | ctx = repo[rev] |
|
1003 | 1003 | base = self.applied[i].node |
|
1004 | 1004 | if ctx.node() != base: |
|
1005 | 1005 | msg = _('cannot delete revision %d above applied patches') |
|
1006 |
raise |
|
|
1006 | raise error.Abort(msg % rev) | |
|
1007 | 1007 | |
|
1008 | 1008 | patch = self.applied[i].name |
|
1009 | 1009 | for fmt in ('[mq]: %s', 'imported patch %s'): |
@@ -1035,7 +1035,7 class queue(object): | |||
|
1035 | 1035 | |
|
1036 | 1036 | def delete(self, repo, patches, opts): |
|
1037 | 1037 | if not patches and not opts.get('rev'): |
|
1038 |
raise |
|
|
1038 | raise error.Abort(_('qdelete requires at least one revision or ' | |
|
1039 | 1039 | 'patch name')) |
|
1040 | 1040 | |
|
1041 | 1041 | realpatches = [] |
@@ -1043,16 +1043,16 class queue(object): | |||
|
1043 | 1043 | patch = self.lookup(patch, strict=True) |
|
1044 | 1044 | info = self.isapplied(patch) |
|
1045 | 1045 | if info: |
|
1046 |
raise |
|
|
1046 | raise error.Abort(_("cannot delete applied patch %s") % patch) | |
|
1047 | 1047 | if patch not in self.series: |
|
1048 |
raise |
|
|
1048 | raise error.Abort(_("patch %s not in series file") % patch) | |
|
1049 | 1049 | if patch not in realpatches: |
|
1050 | 1050 | realpatches.append(patch) |
|
1051 | 1051 | |
|
1052 | 1052 | numrevs = 0 |
|
1053 | 1053 | if opts.get('rev'): |
|
1054 | 1054 | if not self.applied: |
|
1055 |
raise |
|
|
1055 | raise error.Abort(_('no patches applied')) | |
|
1056 | 1056 | revs = scmutil.revrange(repo, opts.get('rev')) |
|
1057 | 1057 | revs.sort() |
|
1058 | 1058 | revpatches = self._revpatches(repo, revs) |
@@ -1067,7 +1067,7 class queue(object): | |||
|
1067 | 1067 | top = self.applied[-1].node |
|
1068 | 1068 | patch = self.applied[-1].name |
|
1069 | 1069 | if repo.dirstate.p1() != top: |
|
1070 |
raise |
|
|
1070 | raise error.Abort(_("working directory revision is not qtip")) | |
|
1071 | 1071 | return top, patch |
|
1072 | 1072 | return None, None |
|
1073 | 1073 | |
@@ -1095,29 +1095,29 class queue(object): | |||
|
1095 | 1095 | _reserved = ('series', 'status', 'guards', '.', '..') |
|
1096 | 1096 | def checkreservedname(self, name): |
|
1097 | 1097 | if name in self._reserved: |
|
1098 |
raise |
|
|
1098 | raise error.Abort(_('"%s" cannot be used as the name of a patch') | |
|
1099 | 1099 | % name) |
|
1100 | 1100 | for prefix in ('.hg', '.mq'): |
|
1101 | 1101 | if name.startswith(prefix): |
|
1102 |
raise |
|
|
1102 | raise error.Abort(_('patch name cannot begin with "%s"') | |
|
1103 | 1103 | % prefix) |
|
1104 | 1104 | for c in ('#', ':', '\r', '\n'): |
|
1105 | 1105 | if c in name: |
|
1106 |
raise |
|
|
1106 | raise error.Abort(_('%r cannot be used in the name of a patch') | |
|
1107 | 1107 | % c) |
|
1108 | 1108 | |
|
1109 | 1109 | def checkpatchname(self, name, force=False): |
|
1110 | 1110 | self.checkreservedname(name) |
|
1111 | 1111 | if not force and os.path.exists(self.join(name)): |
|
1112 | 1112 | if os.path.isdir(self.join(name)): |
|
1113 |
raise |
|
|
1113 | raise error.Abort(_('"%s" already exists as a directory') | |
|
1114 | 1114 | % name) |
|
1115 | 1115 | else: |
|
1116 |
raise |
|
|
1116 | raise error.Abort(_('patch "%s" already exists') % name) | |
|
1117 | 1117 | |
|
1118 | 1118 | def checkkeepchanges(self, keepchanges, force): |
|
1119 | 1119 | if force and keepchanges: |
|
1120 |
raise |
|
|
1120 | raise error.Abort(_('cannot use both --force and --keep-changes')) | |
|
1121 | 1121 | |
|
1122 | 1122 | def new(self, repo, patchfn, *pats, **opts): |
|
1123 | 1123 | """options: |
@@ -1140,7 +1140,7 class queue(object): | |||
|
1140 | 1140 | # detect missing files in pats |
|
1141 | 1141 | def badfn(f, msg): |
|
1142 | 1142 | if f != '.hgsubstate': # .hgsubstate is auto-created |
|
1143 |
raise |
|
|
1143 | raise error.Abort('%s: %s' % (f, msg)) | |
|
1144 | 1144 | match = scmutil.match(repo[None], pats, opts, badfn=badfn) |
|
1145 | 1145 | changes = repo.status(match=match) |
|
1146 | 1146 | else: |
@@ -1150,7 +1150,7 class queue(object): | |||
|
1150 | 1150 | commitfiles.extend(files) |
|
1151 | 1151 | match = scmutil.matchfiles(repo, commitfiles) |
|
1152 | 1152 | if len(repo[None].parents()) > 1: |
|
1153 |
raise |
|
|
1153 | raise error.Abort(_('cannot manage merge changesets')) | |
|
1154 | 1154 | self.checktoppatch(repo) |
|
1155 | 1155 | insert = self.fullseriesend() |
|
1156 | 1156 | wlock = repo.wlock() |
@@ -1159,7 +1159,7 class queue(object): | |||
|
1159 | 1159 | # if patch file write fails, abort early |
|
1160 | 1160 | p = self.opener(patchfn, "w") |
|
1161 | 1161 | except IOError as e: |
|
1162 |
raise |
|
|
1162 | raise error.Abort(_('cannot write patch "%s": %s') | |
|
1163 | 1163 | % (patchfn, e.strerror)) |
|
1164 | 1164 | try: |
|
1165 | 1165 | defaultmsg = "[mq]: %s" % patchfn |
@@ -1182,7 +1182,7 class queue(object): | |||
|
1182 | 1182 | n = newcommit(repo, None, commitmsg, user, date, match=match, |
|
1183 | 1183 | force=True, editor=editor) |
|
1184 | 1184 | if n is None: |
|
1185 |
raise |
|
|
1185 | raise error.Abort(_("repo commit failed")) | |
|
1186 | 1186 | try: |
|
1187 | 1187 | self.fullseries[insert:insert] = [patchfn] |
|
1188 | 1188 | self.applied.append(statusentry(n, patchfn)) |
@@ -1299,7 +1299,7 class queue(object): | |||
|
1299 | 1299 | else: |
|
1300 | 1300 | if i + off < len(self.series): |
|
1301 | 1301 | return self.series[i + off] |
|
1302 |
raise |
|
|
1302 | raise error.Abort(_("patch %s not in series") % patch) | |
|
1303 | 1303 | |
|
1304 | 1304 | def push(self, repo, patch=None, force=False, list=False, mergeq=None, |
|
1305 | 1305 | all=False, move=False, exact=False, nobackup=False, |
@@ -1335,7 +1335,7 class queue(object): | |||
|
1335 | 1335 | pushable, reason = self.pushable(patch) |
|
1336 | 1336 | if pushable: |
|
1337 | 1337 | if self.series.index(patch) < self.seriesend(): |
|
1338 |
raise |
|
|
1338 | raise error.Abort( | |
|
1339 | 1339 | _("cannot push to a previous patch: %s") % patch) |
|
1340 | 1340 | else: |
|
1341 | 1341 | if reason: |
@@ -1364,25 +1364,25 class queue(object): | |||
|
1364 | 1364 | |
|
1365 | 1365 | if exact: |
|
1366 | 1366 | if keepchanges: |
|
1367 |
raise |
|
|
1367 | raise error.Abort( | |
|
1368 | 1368 | _("cannot use --exact and --keep-changes together")) |
|
1369 | 1369 | if move: |
|
1370 |
raise |
|
|
1370 | raise error.Abort(_('cannot use --exact and --move ' | |
|
1371 | 1371 | 'together')) |
|
1372 | 1372 | if self.applied: |
|
1373 |
raise |
|
|
1373 | raise error.Abort(_('cannot push --exact with applied ' | |
|
1374 | 1374 | 'patches')) |
|
1375 | 1375 | root = self.series[start] |
|
1376 | 1376 | target = patchheader(self.join(root), self.plainmode).parent |
|
1377 | 1377 | if not target: |
|
1378 |
raise |
|
|
1378 | raise error.Abort( | |
|
1379 | 1379 | _("%s does not have a parent recorded") % root) |
|
1380 | 1380 | if not repo[target] == repo['.']: |
|
1381 | 1381 | hg.update(repo, target) |
|
1382 | 1382 | |
|
1383 | 1383 | if move: |
|
1384 | 1384 | if not patch: |
|
1385 |
raise |
|
|
1385 | raise error.Abort(_("please specify the patch to move")) | |
|
1386 | 1386 | for fullstart, rpn in enumerate(self.fullseries): |
|
1387 | 1387 | # strip markers for patch guards |
|
1388 | 1388 | if self.guard_re.split(rpn, 1)[0] == self.series[start]: |
@@ -1464,7 +1464,7 class queue(object): | |||
|
1464 | 1464 | patch = self.lookup(patch) |
|
1465 | 1465 | info = self.isapplied(patch) |
|
1466 | 1466 | if not info: |
|
1467 |
raise |
|
|
1467 | raise error.Abort(_("patch %s is not applied") % patch) | |
|
1468 | 1468 | |
|
1469 | 1469 | if not self.applied: |
|
1470 | 1470 | # Allow qpop -a to work repeatedly, |
@@ -1517,13 +1517,13 class queue(object): | |||
|
1517 | 1517 | heads = repo.changelog.heads(rev) |
|
1518 | 1518 | except error.LookupError: |
|
1519 | 1519 | node = short(rev) |
|
1520 |
raise |
|
|
1520 | raise error.Abort(_('trying to pop unknown node %s') % node) | |
|
1521 | 1521 | |
|
1522 | 1522 | if heads != [self.applied[-1].node]: |
|
1523 |
raise |
|
|
1523 | raise error.Abort(_("popping would remove a revision not " | |
|
1524 | 1524 | "managed by this patch queue")) |
|
1525 | 1525 | if not repo[self.applied[-1].node].mutable(): |
|
1526 |
raise |
|
|
1526 | raise error.Abort( | |
|
1527 | 1527 | _("popping would remove a public revision"), |
|
1528 | 1528 | hint=_('see "hg help phases" for details')) |
|
1529 | 1529 | |
@@ -1534,11 +1534,11 class queue(object): | |||
|
1534 | 1534 | ctx = repo[qp] |
|
1535 | 1535 | m, a, r, d = repo.status(qp, '.')[:4] |
|
1536 | 1536 | if d: |
|
1537 |
raise |
|
|
1537 | raise error.Abort(_("deletions found between repo revs")) | |
|
1538 | 1538 | |
|
1539 | 1539 | tobackup = set(a + m + r) & tobackup |
|
1540 | 1540 | if keepchanges and tobackup: |
|
1541 |
raise |
|
|
1541 | raise error.Abort(_("local changes found, refresh first")) | |
|
1542 | 1542 | self.backup(repo, tobackup) |
|
1543 | 1543 | repo.dirstate.beginparentchange() |
|
1544 | 1544 | for f in a: |
@@ -1593,9 +1593,9 class queue(object): | |||
|
1593 | 1593 | self.checktoppatch(repo) |
|
1594 | 1594 | (top, patchfn) = (self.applied[-1].node, self.applied[-1].name) |
|
1595 | 1595 | if repo.changelog.heads(top) != [top]: |
|
1596 |
raise |
|
|
1596 | raise error.Abort(_("cannot refresh a revision with children")) | |
|
1597 | 1597 | if not repo[top].mutable(): |
|
1598 |
raise |
|
|
1598 | raise error.Abort(_("cannot refresh public revision"), | |
|
1599 | 1599 | hint=_('see "hg help phases" for details')) |
|
1600 | 1600 | |
|
1601 | 1601 | cparents = repo.changelog.parents(top) |
@@ -1812,7 +1812,7 class queue(object): | |||
|
1812 | 1812 | |
|
1813 | 1813 | def init(self, repo, create=False): |
|
1814 | 1814 | if not create and os.path.isdir(self.path): |
|
1815 |
raise |
|
|
1815 | raise error.Abort(_("patch queue directory already exists")) | |
|
1816 | 1816 | try: |
|
1817 | 1817 | os.mkdir(self.path) |
|
1818 | 1818 | except OSError as inst: |
@@ -1823,7 +1823,7 class queue(object): | |||
|
1823 | 1823 | |
|
1824 | 1824 | def unapplied(self, repo, patch=None): |
|
1825 | 1825 | if patch and patch not in self.series: |
|
1826 |
raise |
|
|
1826 | raise error.Abort(_("patch %s is not in series file") % patch) | |
|
1827 | 1827 | if not patch: |
|
1828 | 1828 | start = self.seriesend() |
|
1829 | 1829 | else: |
@@ -2031,19 +2031,19 class queue(object): | |||
|
2031 | 2031 | force=None, git=False): |
|
2032 | 2032 | def checkseries(patchname): |
|
2033 | 2033 | if patchname in self.series: |
|
2034 |
raise |
|
|
2034 | raise error.Abort(_('patch %s is already in the series file') | |
|
2035 | 2035 | % patchname) |
|
2036 | 2036 | |
|
2037 | 2037 | if rev: |
|
2038 | 2038 | if files: |
|
2039 |
raise |
|
|
2039 | raise error.Abort(_('option "-r" not valid when importing ' | |
|
2040 | 2040 | 'files')) |
|
2041 | 2041 | rev = scmutil.revrange(repo, rev) |
|
2042 | 2042 | rev.sort(reverse=True) |
|
2043 | 2043 | elif not files: |
|
2044 |
raise |
|
|
2044 | raise error.Abort(_('no files or revisions specified')) | |
|
2045 | 2045 | if (len(files) > 1 or len(rev) > 1) and patchname: |
|
2046 |
raise |
|
|
2046 | raise error.Abort(_('option "-n" not valid when importing multiple ' | |
|
2047 | 2047 | 'patches')) |
|
2048 | 2048 | imported = [] |
|
2049 | 2049 | if rev: |
@@ -2052,21 +2052,21 class queue(object): | |||
|
2052 | 2052 | # Otherwise, they should form a linear path to a head. |
|
2053 | 2053 | heads = repo.changelog.heads(repo.changelog.node(rev.first())) |
|
2054 | 2054 | if len(heads) > 1: |
|
2055 |
raise |
|
|
2055 | raise error.Abort(_('revision %d is the root of more than one ' | |
|
2056 | 2056 | 'branch') % rev.last()) |
|
2057 | 2057 | if self.applied: |
|
2058 | 2058 | base = repo.changelog.node(rev.first()) |
|
2059 | 2059 | if base in [n.node for n in self.applied]: |
|
2060 |
raise |
|
|
2060 | raise error.Abort(_('revision %d is already managed') | |
|
2061 | 2061 | % rev.first()) |
|
2062 | 2062 | if heads != [self.applied[-1].node]: |
|
2063 |
raise |
|
|
2063 | raise error.Abort(_('revision %d is not the parent of ' | |
|
2064 | 2064 | 'the queue') % rev.first()) |
|
2065 | 2065 | base = repo.changelog.rev(self.applied[0].node) |
|
2066 | 2066 | lastparent = repo.changelog.parentrevs(base)[0] |
|
2067 | 2067 | else: |
|
2068 | 2068 | if heads != [repo.changelog.node(rev.first())]: |
|
2069 |
raise |
|
|
2069 | raise error.Abort(_('revision %d has unmanaged children') | |
|
2070 | 2070 | % rev.first()) |
|
2071 | 2071 | lastparent = None |
|
2072 | 2072 | |
@@ -2075,16 +2075,16 class queue(object): | |||
|
2075 | 2075 | try: |
|
2076 | 2076 | for r in rev: |
|
2077 | 2077 | if not repo[r].mutable(): |
|
2078 |
raise |
|
|
2078 | raise error.Abort(_('revision %d is not mutable') % r, | |
|
2079 | 2079 | hint=_('see "hg help phases" ' |
|
2080 | 2080 | 'for details')) |
|
2081 | 2081 | p1, p2 = repo.changelog.parentrevs(r) |
|
2082 | 2082 | n = repo.changelog.node(r) |
|
2083 | 2083 | if p2 != nullrev: |
|
2084 |
raise |
|
|
2084 | raise error.Abort(_('cannot import merge revision %d') | |
|
2085 | 2085 | % r) |
|
2086 | 2086 | if lastparent and lastparent != r: |
|
2087 |
raise |
|
|
2087 | raise error.Abort(_('revision %d is not the parent of ' | |
|
2088 | 2088 | '%d') |
|
2089 | 2089 | % (r, lastparent)) |
|
2090 | 2090 | lastparent = p1 |
@@ -2118,13 +2118,14 class queue(object): | |||
|
2118 | 2118 | for i, filename in enumerate(files): |
|
2119 | 2119 | if existing: |
|
2120 | 2120 | if filename == '-': |
|
2121 |
raise |
|
|
2121 | raise error.Abort(_('-e is incompatible with import from -') | |
|
2122 | ) | |
|
2122 | 2123 | filename = normname(filename) |
|
2123 | 2124 | self.checkreservedname(filename) |
|
2124 | 2125 | if util.url(filename).islocal(): |
|
2125 | 2126 | originpath = self.join(filename) |
|
2126 | 2127 | if not os.path.isfile(originpath): |
|
2127 |
raise |
|
|
2128 | raise error.Abort( | |
|
2128 | 2129 | _("patch %s does not exist") % filename) |
|
2129 | 2130 | |
|
2130 | 2131 | if patchname: |
@@ -2138,7 +2139,7 class queue(object): | |||
|
2138 | 2139 | |
|
2139 | 2140 | else: |
|
2140 | 2141 | if filename == '-' and not patchname: |
|
2141 |
raise |
|
|
2142 | raise error.Abort(_('need --name to import a patch from -')) | |
|
2142 | 2143 | elif not patchname: |
|
2143 | 2144 | patchname = normname(os.path.basename(filename.rstrip('/'))) |
|
2144 | 2145 | self.checkpatchname(patchname, force) |
@@ -2150,7 +2151,7 class queue(object): | |||
|
2150 | 2151 | text = fp.read() |
|
2151 | 2152 | fp.close() |
|
2152 | 2153 | except (OSError, IOError): |
|
2153 |
raise |
|
|
2154 | raise error.Abort(_("unable to read file %s") % filename) | |
|
2154 | 2155 | patchf = self.opener(patchname, "w") |
|
2155 | 2156 | patchf.write(text) |
|
2156 | 2157 | patchf.close() |
@@ -2209,7 +2210,7 def applied(ui, repo, patch=None, **opts | |||
|
2209 | 2210 | |
|
2210 | 2211 | if patch: |
|
2211 | 2212 | if patch not in q.series: |
|
2212 |
raise |
|
|
2213 | raise error.Abort(_("patch %s is not in series file") % patch) | |
|
2213 | 2214 | end = q.series.index(patch) + 1 |
|
2214 | 2215 | else: |
|
2215 | 2216 | end = q.seriesend(True) |
@@ -2241,7 +2242,7 def unapplied(ui, repo, patch=None, **op | |||
|
2241 | 2242 | q = repo.mq |
|
2242 | 2243 | if patch: |
|
2243 | 2244 | if patch not in q.series: |
|
2244 |
raise |
|
|
2245 | raise error.Abort(_("patch %s is not in series file") % patch) | |
|
2245 | 2246 | start = q.series.index(patch) + 1 |
|
2246 | 2247 | else: |
|
2247 | 2248 | start = q.seriesend(True) |
@@ -2408,7 +2409,7 def clone(ui, source, dest=None, **opts) | |||
|
2408 | 2409 | try: |
|
2409 | 2410 | hg.peer(ui, opts, patchespath) |
|
2410 | 2411 | except error.RepoError: |
|
2411 |
raise |
|
|
2412 | raise error.Abort(_('versioned patch repository not found' | |
|
2412 | 2413 | ' (see init --mq)')) |
|
2413 | 2414 | qbase, destrev = None, None |
|
2414 | 2415 | if sr.local(): |
@@ -2458,7 +2459,7 def commit(ui, repo, *pats, **opts): | |||
|
2458 | 2459 | q = repo.mq |
|
2459 | 2460 | r = q.qrepo() |
|
2460 | 2461 | if not r: |
|
2461 |
raise |
|
|
2462 | raise error.Abort('no queue repository') | |
|
2462 | 2463 | commands.commit(r.ui, r, *pats, **opts) |
|
2463 | 2464 | |
|
2464 | 2465 | @command("qseries", |
@@ -2663,9 +2664,9 def fold(ui, repo, *files, **opts): | |||
|
2663 | 2664 | Returns 0 on success.""" |
|
2664 | 2665 | q = repo.mq |
|
2665 | 2666 | if not files: |
|
2666 |
raise |
|
|
2667 | raise error.Abort(_('qfold requires at least one patch name')) | |
|
2667 | 2668 | if not q.checktoppatch(repo)[0]: |
|
2668 |
raise |
|
|
2669 | raise error.Abort(_('no patches applied')) | |
|
2669 | 2670 | q.checklocalchanges(repo) |
|
2670 | 2671 | |
|
2671 | 2672 | message = cmdutil.logmessage(ui, opts) |
@@ -2678,7 +2679,7 def fold(ui, repo, *files, **opts): | |||
|
2678 | 2679 | if p in patches or p == parent: |
|
2679 | 2680 | ui.warn(_('skipping already folded patch %s\n') % p) |
|
2680 | 2681 | if q.isapplied(p): |
|
2681 |
raise |
|
|
2682 | raise error.Abort(_('qfold cannot fold already applied patch %s') | |
|
2682 | 2683 | % p) |
|
2683 | 2684 | patches.append(p) |
|
2684 | 2685 | |
@@ -2690,7 +2691,7 def fold(ui, repo, *files, **opts): | |||
|
2690 | 2691 | pf = q.join(p) |
|
2691 | 2692 | (patchsuccess, files, fuzz) = q.patch(repo, pf) |
|
2692 | 2693 | if not patchsuccess: |
|
2693 |
raise |
|
|
2694 | raise error.Abort(_('error folding patch %s') % p) | |
|
2694 | 2695 | |
|
2695 | 2696 | if not message: |
|
2696 | 2697 | ph = patchheader(q.join(parent), q.plainmode) |
@@ -2789,23 +2790,23 def guard(ui, repo, *args, **opts): | |||
|
2789 | 2790 | args = list(args) |
|
2790 | 2791 | if opts.get('list'): |
|
2791 | 2792 | if args or opts.get('none'): |
|
2792 |
raise |
|
|
2793 | raise error.Abort(_('cannot mix -l/--list with options or ' | |
|
2793 | 2794 | 'arguments')) |
|
2794 | 2795 | for i in xrange(len(q.series)): |
|
2795 | 2796 | status(i) |
|
2796 | 2797 | return |
|
2797 | 2798 | if not args or args[0][0:1] in '-+': |
|
2798 | 2799 | if not q.applied: |
|
2799 |
raise |
|
|
2800 | raise error.Abort(_('no patches applied')) | |
|
2800 | 2801 | patch = q.applied[-1].name |
|
2801 | 2802 | if patch is None and args[0][0:1] not in '-+': |
|
2802 | 2803 | patch = args.pop(0) |
|
2803 | 2804 | if patch is None: |
|
2804 |
raise |
|
|
2805 | raise error.Abort(_('no patch to work with')) | |
|
2805 | 2806 | if args or opts.get('none'): |
|
2806 | 2807 | idx = q.findseries(patch) |
|
2807 | 2808 | if idx is None: |
|
2808 |
raise |
|
|
2809 | raise error.Abort(_('no patch named %s') % patch) | |
|
2809 | 2810 | q.setguards(idx, args) |
|
2810 | 2811 | q.savedirty() |
|
2811 | 2812 | else: |
@@ -3031,10 +3032,10 def save(ui, repo, **opts): | |||
|
3031 | 3032 | newpath = os.path.join(q.basepath, opts.get('name')) |
|
3032 | 3033 | if os.path.exists(newpath): |
|
3033 | 3034 | if not os.path.isdir(newpath): |
|
3034 |
raise |
|
|
3035 | raise error.Abort(_('destination %s exists and is not ' | |
|
3035 | 3036 | 'a directory') % newpath) |
|
3036 | 3037 | if not opts.get('force'): |
|
3037 |
raise |
|
|
3038 | raise error.Abort(_('destination %s exists, ' | |
|
3038 | 3039 | 'use -f to force') % newpath) |
|
3039 | 3040 | else: |
|
3040 | 3041 | newpath = savename(path) |
@@ -3178,7 +3179,7 def finish(ui, repo, *revrange, **opts): | |||
|
3178 | 3179 | Returns 0 on success. |
|
3179 | 3180 | """ |
|
3180 | 3181 | if not opts.get('applied') and not revrange: |
|
3181 |
raise |
|
|
3182 | raise error.Abort(_('no revisions specified')) | |
|
3182 | 3183 | elif opts.get('applied'): |
|
3183 | 3184 | revrange = ('qbase::qtip',) + revrange |
|
3184 | 3185 | |
@@ -3267,7 +3268,7 def qqueue(ui, repo, name=None, **opts): | |||
|
3267 | 3268 | |
|
3268 | 3269 | def _setactive(name): |
|
3269 | 3270 | if q.applied: |
|
3270 |
raise |
|
|
3271 | raise error.Abort(_('new queue created, but cannot make active ' | |
|
3271 | 3272 | 'as patches are applied')) |
|
3272 | 3273 | _setactivenocheck(name) |
|
3273 | 3274 | |
@@ -3296,12 +3297,12 def qqueue(ui, repo, name=None, **opts): | |||
|
3296 | 3297 | |
|
3297 | 3298 | def _delete(name): |
|
3298 | 3299 | if name not in existing: |
|
3299 |
raise |
|
|
3300 | raise error.Abort(_('cannot delete queue that does not exist')) | |
|
3300 | 3301 | |
|
3301 | 3302 | current = _getcurrent() |
|
3302 | 3303 | |
|
3303 | 3304 | if name == current: |
|
3304 |
raise |
|
|
3305 | raise error.Abort(_('cannot delete currently active queue')) | |
|
3305 | 3306 | |
|
3306 | 3307 | fh = repo.vfs('patches.queues.new', 'w') |
|
3307 | 3308 | for queue in existing: |
@@ -3325,14 +3326,14 def qqueue(ui, repo, name=None, **opts): | |||
|
3325 | 3326 | return |
|
3326 | 3327 | |
|
3327 | 3328 | if not _validname(name): |
|
3328 |
raise |
|
|
3329 | raise error.Abort( | |
|
3329 | 3330 | _('invalid queue name, may not contain the characters ":\\/."')) |
|
3330 | 3331 | |
|
3331 | 3332 | existing = _getqueues() |
|
3332 | 3333 | |
|
3333 | 3334 | if opts.get('create'): |
|
3334 | 3335 | if name in existing: |
|
3335 |
raise |
|
|
3336 | raise error.Abort(_('queue "%s" already exists') % name) | |
|
3336 | 3337 | if _noqueues(): |
|
3337 | 3338 | _addqueue(_defaultqueue) |
|
3338 | 3339 | _addqueue(name) |
@@ -3340,15 +3341,16 def qqueue(ui, repo, name=None, **opts): | |||
|
3340 | 3341 | elif opts.get('rename'): |
|
3341 | 3342 | current = _getcurrent() |
|
3342 | 3343 | if name == current: |
|
3343 |
raise |
|
|
3344 | raise error.Abort(_('can\'t rename "%s" to its current name') | |
|
3345 | % name) | |
|
3344 | 3346 | if name in existing: |
|
3345 |
raise |
|
|
3347 | raise error.Abort(_('queue "%s" already exists') % name) | |
|
3346 | 3348 | |
|
3347 | 3349 | olddir = _queuedir(current) |
|
3348 | 3350 | newdir = _queuedir(name) |
|
3349 | 3351 | |
|
3350 | 3352 | if os.path.exists(newdir): |
|
3351 |
raise |
|
|
3353 | raise error.Abort(_('non-queue directory "%s" already exists') % | |
|
3352 | 3354 | newdir) |
|
3353 | 3355 | |
|
3354 | 3356 | fh = repo.vfs('patches.queues.new', 'w') |
@@ -3372,7 +3374,7 def qqueue(ui, repo, name=None, **opts): | |||
|
3372 | 3374 | shutil.rmtree(qdir) |
|
3373 | 3375 | else: |
|
3374 | 3376 | if name not in existing: |
|
3375 |
raise |
|
|
3377 | raise error.Abort(_('use --create to create a new queue')) | |
|
3376 | 3378 | _setactive(name) |
|
3377 | 3379 | |
|
3378 | 3380 | def mqphasedefaults(repo, roots): |
@@ -3403,7 +3405,7 def reposetup(ui, repo): | |||
|
3403 | 3405 | parents = self.dirstate.parents() |
|
3404 | 3406 | patches = [s.node for s in self.mq.applied] |
|
3405 | 3407 | if parents[0] in patches or parents[1] in patches: |
|
3406 |
raise |
|
|
3408 | raise error.Abort(errmsg) | |
|
3407 | 3409 | |
|
3408 | 3410 | def commit(self, text="", user=None, date=None, match=None, |
|
3409 | 3411 | force=False, editor=False, extra={}): |
@@ -3430,7 +3432,7 def reposetup(ui, repo): | |||
|
3430 | 3432 | # looking for pushed and shared changeset |
|
3431 | 3433 | for node in outapplied: |
|
3432 | 3434 | if self[node].phase() < phases.secret: |
|
3433 |
raise |
|
|
3435 | raise error.Abort(_('source has mq patches applied')) | |
|
3434 | 3436 | # no non-secret patches pushed |
|
3435 | 3437 | super(mqrepo, self).checkpush(pushop) |
|
3436 | 3438 | |
@@ -3492,12 +3494,12 def mqinit(orig, ui, *args, **kwargs): | |||
|
3492 | 3494 | if args: |
|
3493 | 3495 | repopath = args[0] |
|
3494 | 3496 | if not hg.islocal(repopath): |
|
3495 |
raise |
|
|
3497 | raise error.Abort(_('only a local queue repository ' | |
|
3496 | 3498 | 'may be initialized')) |
|
3497 | 3499 | else: |
|
3498 | 3500 | repopath = cmdutil.findrepo(os.getcwd()) |
|
3499 | 3501 | if not repopath: |
|
3500 |
raise |
|
|
3502 | raise error.Abort(_('there is no Mercurial repository here ' | |
|
3501 | 3503 | '(.hg not found)')) |
|
3502 | 3504 | repo = hg.repository(ui, repopath) |
|
3503 | 3505 | return qinit(ui, repo, True) |
@@ -3514,7 +3516,7 def mqcommand(orig, ui, repo, *args, **k | |||
|
3514 | 3516 | q = repo.mq |
|
3515 | 3517 | r = q.qrepo() |
|
3516 | 3518 | if not r: |
|
3517 |
raise |
|
|
3519 | raise error.Abort(_('no queue repository')) | |
|
3518 | 3520 | return orig(r.ui, r, *args, **kwargs) |
|
3519 | 3521 | |
|
3520 | 3522 | def summaryhook(ui, repo): |
@@ -135,7 +135,7 web.baseurl | |||
|
135 | 135 | |
|
136 | 136 | import email, socket, time |
|
137 | 137 | from mercurial.i18n import _ |
|
138 | from mercurial import patch, cmdutil, util, mail | |
|
138 | from mercurial import patch, cmdutil, util, mail, error | |
|
139 | 139 | import fnmatch |
|
140 | 140 | |
|
141 | 141 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
@@ -277,7 +277,7 class notifier(object): | |||
|
277 | 277 | try: |
|
278 | 278 | msg = p.parsestr(data) |
|
279 | 279 | except email.Errors.MessageParseError as inst: |
|
280 |
raise |
|
|
280 | raise error.Abort(inst) | |
|
281 | 281 | |
|
282 | 282 | # store sender and subject |
|
283 | 283 | sender, subject = msg['From'], msg['Subject'] |
@@ -60,7 +60,7 You can set patchbomb to always ask for | |||
|
60 | 60 | import os, errno, socket, tempfile, cStringIO |
|
61 | 61 | import email |
|
62 | 62 | |
|
63 | from mercurial import cmdutil, commands, hg, mail, patch, util | |
|
63 | from mercurial import cmdutil, commands, hg, mail, patch, util, error | |
|
64 | 64 | from mercurial import scmutil |
|
65 | 65 | from mercurial.i18n import _ |
|
66 | 66 | from mercurial.node import bin |
@@ -501,15 +501,15 def patchbomb(ui, repo, *revs, **opts): | |||
|
501 | 501 | mail.validateconfig(ui) |
|
502 | 502 | |
|
503 | 503 | if not (revs or rev or outgoing or bundle or patches): |
|
504 |
raise |
|
|
504 | raise error.Abort(_('specify at least one changeset with -r or -o')) | |
|
505 | 505 | |
|
506 | 506 | if outgoing and bundle: |
|
507 |
raise |
|
|
507 | raise error.Abort(_("--outgoing mode always on with --bundle;" | |
|
508 | 508 | " do not re-specify --outgoing")) |
|
509 | 509 | |
|
510 | 510 | if outgoing or bundle: |
|
511 | 511 | if len(revs) > 1: |
|
512 |
raise |
|
|
512 | raise error.Abort(_("too many destinations")) | |
|
513 | 513 | if revs: |
|
514 | 514 | dest = revs[0] |
|
515 | 515 | else: |
@@ -518,7 +518,7 def patchbomb(ui, repo, *revs, **opts): | |||
|
518 | 518 | |
|
519 | 519 | if rev: |
|
520 | 520 | if revs: |
|
521 |
raise |
|
|
521 | raise error.Abort(_('use only one form to specify the revision')) | |
|
522 | 522 | revs = rev |
|
523 | 523 | |
|
524 | 524 | revs = scmutil.revrange(repo, revs) |
@@ -578,7 +578,7 def patchbomb(ui, repo, *revs, **opts): | |||
|
578 | 578 | to = getaddrs('To', ask=True) |
|
579 | 579 | if not to: |
|
580 | 580 | # we can get here in non-interactive mode |
|
581 |
raise |
|
|
581 | raise error.Abort(_('no recipient addresses provided')) | |
|
582 | 582 | cc = getaddrs('Cc', ask=True, default='') or [] |
|
583 | 583 | bcc = getaddrs('Bcc') or [] |
|
584 | 584 | replyto = getaddrs('Reply-To') |
@@ -598,7 +598,7 def patchbomb(ui, repo, *revs, **opts): | |||
|
598 | 598 | ui.write('\n') |
|
599 | 599 | if ui.promptchoice(_('are you sure you want to send (yn)?' |
|
600 | 600 | '$$ &Yes $$ &No')): |
|
601 |
raise |
|
|
601 | raise error.Abort(_('patchbomb canceled')) | |
|
602 | 602 | |
|
603 | 603 | ui.write('\n') |
|
604 | 604 |
@@ -24,7 +24,7 | |||
|
24 | 24 | |
|
25 | 25 | '''command to delete untracked files from the working directory''' |
|
26 | 26 | |
|
27 | from mercurial import util, commands, cmdutil, scmutil | |
|
27 | from mercurial import util, commands, cmdutil, scmutil, error | |
|
28 | 28 | from mercurial.i18n import _ |
|
29 | 29 | import os |
|
30 | 30 | |
@@ -94,7 +94,7 def purge(ui, repo, *dirs, **opts): | |||
|
94 | 94 | except OSError: |
|
95 | 95 | m = _('%s cannot be removed') % name |
|
96 | 96 | if opts['abort_on_err']: |
|
97 |
raise |
|
|
97 | raise error.Abort(m) | |
|
98 | 98 | ui.warn(_('warning: %s\n') % m) |
|
99 | 99 | else: |
|
100 | 100 | ui.write('%s%s' % (name, eol)) |
@@ -225,20 +225,20 def rebase(ui, repo, **opts): | |||
|
225 | 225 | help = "hg%s help -e histedit" % enablehistedit |
|
226 | 226 | msg = _("interactive history editing is supported by the " |
|
227 | 227 | "'histedit' extension (see \"%s\")") % help |
|
228 |
raise |
|
|
228 | raise error.Abort(msg) | |
|
229 | 229 | |
|
230 | 230 | if collapsemsg and not collapsef: |
|
231 |
raise |
|
|
231 | raise error.Abort( | |
|
232 | 232 | _('message can only be specified with collapse')) |
|
233 | 233 | |
|
234 | 234 | if contf or abortf: |
|
235 | 235 | if contf and abortf: |
|
236 |
raise |
|
|
236 | raise error.Abort(_('cannot use both abort and continue')) | |
|
237 | 237 | if collapsef: |
|
238 |
raise |
|
|
238 | raise error.Abort( | |
|
239 | 239 | _('cannot use collapse with continue or abort')) |
|
240 | 240 | if srcf or basef or destf: |
|
241 |
raise |
|
|
241 | raise error.Abort( | |
|
242 | 242 | _('abort and continue do not allow specifying revisions')) |
|
243 | 243 | if abortf and opts.get('tool', False): |
|
244 | 244 | ui.warn(_('tool option will be ignored\n')) |
@@ -255,19 +255,19 def rebase(ui, repo, **opts): | |||
|
255 | 255 | else: |
|
256 | 256 | msg = _('cannot continue inconsistent rebase') |
|
257 | 257 | hint = _('use "hg rebase --abort" to clear broken state') |
|
258 |
raise |
|
|
258 | raise error.Abort(msg, hint=hint) | |
|
259 | 259 | if abortf: |
|
260 | 260 | return abort(repo, originalwd, target, state, |
|
261 | 261 | activebookmark=activebookmark) |
|
262 | 262 | else: |
|
263 | 263 | if srcf and basef: |
|
264 |
raise |
|
|
264 | raise error.Abort(_('cannot specify both a ' | |
|
265 | 265 | 'source and a base')) |
|
266 | 266 | if revf and basef: |
|
267 |
raise |
|
|
267 | raise error.Abort(_('cannot specify both a ' | |
|
268 | 268 | 'revision and a base')) |
|
269 | 269 | if revf and srcf: |
|
270 |
raise |
|
|
270 | raise error.Abort(_('cannot specify both a ' | |
|
271 | 271 | 'revision and a source')) |
|
272 | 272 | |
|
273 | 273 | cmdutil.checkunfinished(repo) |
@@ -335,7 +335,7 def rebase(ui, repo, **opts): | |||
|
335 | 335 | if (not (keepf or allowunstable) |
|
336 | 336 | and repo.revs('first(children(%ld) - %ld)', |
|
337 | 337 | rebaseset, rebaseset)): |
|
338 |
raise |
|
|
338 | raise error.Abort( | |
|
339 | 339 | _("can't remove original changesets with" |
|
340 | 340 | " unrebased descendants"), |
|
341 | 341 | hint=_('use --keep to keep original changesets')) |
@@ -361,7 +361,7 def rebase(ui, repo, **opts): | |||
|
361 | 361 | |
|
362 | 362 | root = min(rebaseset) |
|
363 | 363 | if not keepf and not repo[root].mutable(): |
|
364 |
raise |
|
|
364 | raise error.Abort(_("can't rebase public changeset %s") | |
|
365 | 365 | % repo[root], |
|
366 | 366 | hint=_('see "hg help phases" for details')) |
|
367 | 367 | |
@@ -384,7 +384,7 def rebase(ui, repo, **opts): | |||
|
384 | 384 | for rev in state: |
|
385 | 385 | branches.add(repo[rev].branch()) |
|
386 | 386 | if len(branches) > 1: |
|
387 |
raise |
|
|
387 | raise error.Abort(_('cannot collapse multiple named ' | |
|
388 | 388 | 'branches')) |
|
389 | 389 | |
|
390 | 390 | # Rebase |
@@ -564,7 +564,7 def externalparent(repo, state, targetan | |||
|
564 | 564 | return nullrev |
|
565 | 565 | if len(parents) == 1: |
|
566 | 566 | return parents.pop() |
|
567 |
raise |
|
|
567 | raise error.Abort(_('unable to collapse on top of %s, there is more ' | |
|
568 | 568 | 'than one external parent: %s') % |
|
569 | 569 | (max(targetancestors), |
|
570 | 570 | ', '.join(str(p) for p in sorted(parents)))) |
@@ -677,7 +677,7 def defineparents(repo, rev, target, sta | |||
|
677 | 677 | p2 = state[p2n] |
|
678 | 678 | else: # p2n external |
|
679 | 679 | if p2 != nullrev: # p1n external too => rev is a merged revision |
|
680 |
raise |
|
|
680 | raise error.Abort(_('cannot use revision %d as base, result ' | |
|
681 | 681 | 'would have 3 parents') % rev) |
|
682 | 682 | p2 = p2n |
|
683 | 683 | repo.ui.debug(" future parents are %d and %d\n" % |
@@ -866,7 +866,7 def restorestatus(repo): | |||
|
866 | 866 | state[repo[oldrev].rev()] = repo[newrev].rev() |
|
867 | 867 | |
|
868 | 868 | if keepbranches is None: |
|
869 |
raise |
|
|
869 | raise error.Abort(_('.hg/rebasestate is incomplete')) | |
|
870 | 870 | |
|
871 | 871 | skipped = set() |
|
872 | 872 | # recompute the set of skipped revs |
@@ -885,7 +885,7 def restorestatus(repo): | |||
|
885 | 885 | except IOError as err: |
|
886 | 886 | if err.errno != errno.ENOENT: |
|
887 | 887 | raise |
|
888 |
raise |
|
|
888 | raise error.Abort(_('no rebase in progress')) | |
|
889 | 889 | |
|
890 | 890 | def needupdate(repo, state): |
|
891 | 891 | '''check whether we should `update --clean` away from a merge, or if |
@@ -959,18 +959,18 def buildstate(repo, dest, rebaseset, co | |||
|
959 | 959 | # a partially completed rebase is blocked by mq. |
|
960 | 960 | if 'qtip' in repo.tags() and (dest.node() in |
|
961 | 961 | [s.node for s in repo.mq.applied]): |
|
962 |
raise |
|
|
962 | raise error.Abort(_('cannot rebase onto an applied mq patch')) | |
|
963 | 963 | |
|
964 | 964 | roots = list(repo.set('roots(%ld)', rebaseset)) |
|
965 | 965 | if not roots: |
|
966 |
raise |
|
|
966 | raise error.Abort(_('no matching revisions')) | |
|
967 | 967 | roots.sort() |
|
968 | 968 | state = {} |
|
969 | 969 | detachset = set() |
|
970 | 970 | for root in roots: |
|
971 | 971 | commonbase = root.ancestor(dest) |
|
972 | 972 | if commonbase == root: |
|
973 |
raise |
|
|
973 | raise error.Abort(_('source is ancestor of destination')) | |
|
974 | 974 | if commonbase == dest: |
|
975 | 975 | samebranch = root.branch() == dest.branch() |
|
976 | 976 | if not collapse and samebranch and root in dest.children(): |
@@ -1114,7 +1114,7 def pullrebase(orig, ui, repo, *args, ** | |||
|
1114 | 1114 | release(lock, wlock) |
|
1115 | 1115 | else: |
|
1116 | 1116 | if opts.get('tool'): |
|
1117 |
raise |
|
|
1117 | raise error.Abort(_('--tool can only be used with --rebase')) | |
|
1118 | 1118 | orig(ui, repo, *args, **opts) |
|
1119 | 1119 | |
|
1120 | 1120 | def _setrebasesetvisibility(repo, revs): |
@@ -9,7 +9,7 | |||
|
9 | 9 | |
|
10 | 10 | from mercurial.i18n import _ |
|
11 | 11 | from mercurial import cmdutil, commands, extensions |
|
12 |
from mercurial import |
|
|
12 | from mercurial import error | |
|
13 | 13 | |
|
14 | 14 | cmdtable = {} |
|
15 | 15 | command = cmdutil.command(cmdtable) |
@@ -54,7 +54,7 def record(ui, repo, *pats, **opts): | |||
|
54 | 54 | This command is not available when committing a merge.''' |
|
55 | 55 | |
|
56 | 56 | if not ui.interactive(): |
|
57 |
raise |
|
|
57 | raise error.Abort(_('running non-interactively, use %s instead') % | |
|
58 | 58 | 'commit') |
|
59 | 59 | |
|
60 | 60 | opts["interactive"] = True |
@@ -99,7 +99,7 def _qrecord(cmdsuggest, ui, repo, patch | |||
|
99 | 99 | try: |
|
100 | 100 | mq = extensions.find('mq') |
|
101 | 101 | except KeyError: |
|
102 |
raise |
|
|
102 | raise error.Abort(_("'mq' extension not loaded")) | |
|
103 | 103 | |
|
104 | 104 | repo.mq.checkpatchname(patch) |
|
105 | 105 |
@@ -7,7 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | """recreates hardlinks between repository clones""" |
|
9 | 9 | |
|
10 | from mercurial import cmdutil, hg, util | |
|
10 | from mercurial import cmdutil, hg, util, error | |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | 12 | import os, stat |
|
13 | 13 | |
@@ -47,7 +47,7 def relink(ui, repo, origin=None, **opts | |||
|
47 | 47 | """ |
|
48 | 48 | if (not util.safehasattr(util, 'samefile') or |
|
49 | 49 | not util.safehasattr(util, 'samedevice')): |
|
50 |
raise |
|
|
50 | raise error.Abort(_('hardlinks are not supported on this system')) | |
|
51 | 51 | src = hg.repository(repo.baseui, ui.expandpath(origin or 'default-relink', |
|
52 | 52 | origin or 'default')) |
|
53 | 53 | ui.status(_('relinking %s to %s\n') % (src.store.path, repo.store.path)) |
@@ -57,7 +57,7 def relink(ui, repo, origin=None, **opts | |||
|
57 | 57 | |
|
58 | 58 | if not util.samedevice(src.store.path, repo.store.path): |
|
59 | 59 | # No point in continuing |
|
60 |
raise |
|
|
60 | raise error.Abort(_('source and destination are on different devices')) | |
|
61 | 61 | |
|
62 | 62 | locallock = repo.lock() |
|
63 | 63 | try: |
@@ -114,7 +114,7 def prune(candidates, src, dst, ui): | |||
|
114 | 114 | return False |
|
115 | 115 | if not util.samedevice(src, dst): |
|
116 | 116 | # No point in continuing |
|
117 |
raise |
|
|
117 | raise error.Abort( | |
|
118 | 118 | _('source and destination are on different devices')) |
|
119 | 119 | if st.st_size != ts.st_size: |
|
120 | 120 | return False |
@@ -41,7 +41,7 same name. | |||
|
41 | 41 | """ |
|
42 | 42 | |
|
43 | 43 | import os, re |
|
44 | from mercurial import extensions, hg, templater, util | |
|
44 | from mercurial import extensions, hg, templater, util, error | |
|
45 | 45 | from mercurial.i18n import _ |
|
46 | 46 | |
|
47 | 47 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
@@ -69,7 +69,7 class ShortRepository(object): | |||
|
69 | 69 | try: |
|
70 | 70 | url = url.split('://', 1)[1] |
|
71 | 71 | except IndexError: |
|
72 |
raise |
|
|
72 | raise error.Abort(_("no '://' in scheme url '%s'") % url) | |
|
73 | 73 | parts = url.split('/', self.parts) |
|
74 | 74 | if len(parts) > self.parts: |
|
75 | 75 | tail = parts[-1] |
@@ -101,7 +101,7 def extsetup(ui): | |||
|
101 | 101 | for scheme, url in schemes.items(): |
|
102 | 102 | if (os.name == 'nt' and len(scheme) == 1 and scheme.isalpha() |
|
103 | 103 | and os.path.exists('%s:\\' % scheme)): |
|
104 |
raise |
|
|
104 | raise error.Abort(_('custom scheme %s:// conflicts with drive ' | |
|
105 | 105 | 'letter %s:\\\n') % (scheme, scheme.upper())) |
|
106 | 106 | hg.schemes[scheme] = ShortRepository(url, scheme, t) |
|
107 | 107 |
@@ -38,7 +38,7 The following ``share.`` config options | |||
|
38 | 38 | ''' |
|
39 | 39 | |
|
40 | 40 | from mercurial.i18n import _ |
|
41 | from mercurial import cmdutil, commands, hg, util, extensions, bookmarks | |
|
41 | from mercurial import cmdutil, commands, hg, util, extensions, bookmarks, error | |
|
42 | 42 | from mercurial.hg import repository, parseurl |
|
43 | 43 | import errno |
|
44 | 44 | |
@@ -83,7 +83,7 def unshare(ui, repo): | |||
|
83 | 83 | """ |
|
84 | 84 | |
|
85 | 85 | if not repo.shared(): |
|
86 |
raise |
|
|
86 | raise error.Abort(_("this is not a shared repo")) | |
|
87 | 87 | |
|
88 | 88 | destlock = lock = None |
|
89 | 89 | lock = repo.lock() |
@@ -90,7 +90,7 class shelvedfile(object): | |||
|
90 | 90 | except IOError as err: |
|
91 | 91 | if err.errno != errno.ENOENT: |
|
92 | 92 | raise |
|
93 |
raise |
|
|
93 | raise error.Abort(_("shelved change '%s' not found") % self.name) | |
|
94 | 94 | |
|
95 | 95 | def applybundle(self): |
|
96 | 96 | fp = self.opener() |
@@ -135,7 +135,7 class shelvedstate(object): | |||
|
135 | 135 | version = int(fp.readline().strip()) |
|
136 | 136 | |
|
137 | 137 | if version != cls._version: |
|
138 |
raise |
|
|
138 | raise error.Abort(_('this version of shelve is incompatible ' | |
|
139 | 139 | 'with the version used in this repo')) |
|
140 | 140 | name = fp.readline().strip() |
|
141 | 141 | wctx = fp.readline().strip() |
@@ -239,7 +239,7 def createcmd(ui, repo, pats, opts): | |||
|
239 | 239 | wctx = repo[None] |
|
240 | 240 | parents = wctx.parents() |
|
241 | 241 | if len(parents) > 1: |
|
242 |
raise |
|
|
242 | raise error.Abort(_('cannot shelve while merging')) | |
|
243 | 243 | parent = parents[0] |
|
244 | 244 | |
|
245 | 245 | # we never need the user, so we use a generic user for all shelve operations |
@@ -290,22 +290,22 def createcmd(ui, repo, pats, opts): | |||
|
290 | 290 | |
|
291 | 291 | if name: |
|
292 | 292 | if shelvedfile(repo, name, 'hg').exists(): |
|
293 |
raise |
|
|
294 | % name) | |
|
293 | raise error.Abort(_("a shelved change named '%s' already exists" | |
|
294 | ) % name) | |
|
295 | 295 | else: |
|
296 | 296 | for n in gennames(): |
|
297 | 297 | if not shelvedfile(repo, n, 'hg').exists(): |
|
298 | 298 | name = n |
|
299 | 299 | break |
|
300 | 300 | else: |
|
301 |
raise |
|
|
301 | raise error.Abort(_("too many shelved changes named '%s'") % | |
|
302 | 302 | label) |
|
303 | 303 | |
|
304 | 304 | # ensure we are not creating a subdirectory or a hidden file |
|
305 | 305 | if '/' in name or '\\' in name: |
|
306 |
raise |
|
|
306 | raise error.Abort(_('shelved change names may not contain slashes')) | |
|
307 | 307 | if name.startswith('.'): |
|
308 |
raise |
|
|
308 | raise error.Abort(_("shelved change names may not start with '.'")) | |
|
309 | 309 | interactive = opts.get('interactive', False) |
|
310 | 310 | |
|
311 | 311 | def interactivecommitfunc(ui, repo, *pats, **opts): |
@@ -359,7 +359,7 def cleanupcmd(ui, repo): | |||
|
359 | 359 | def deletecmd(ui, repo, pats): |
|
360 | 360 | """subcommand that deletes a specific shelve""" |
|
361 | 361 | if not pats: |
|
362 |
raise |
|
|
362 | raise error.Abort(_('no shelved changes specified!')) | |
|
363 | 363 | wlock = repo.wlock() |
|
364 | 364 | try: |
|
365 | 365 | for name in pats: |
@@ -369,7 +369,7 def deletecmd(ui, repo, pats): | |||
|
369 | 369 | except OSError as err: |
|
370 | 370 | if err.errno != errno.ENOENT: |
|
371 | 371 | raise |
|
372 |
raise |
|
|
372 | raise error.Abort(_("shelved change '%s' not found") % name) | |
|
373 | 373 | finally: |
|
374 | 374 | lockmod.release(wlock) |
|
375 | 375 | |
@@ -441,18 +441,18 def listcmd(ui, repo, pats, opts): | |||
|
441 | 441 | def singlepatchcmds(ui, repo, pats, opts, subcommand): |
|
442 | 442 | """subcommand that displays a single shelf""" |
|
443 | 443 | if len(pats) != 1: |
|
444 |
raise |
|
|
444 | raise error.Abort(_("--%s expects a single shelf") % subcommand) | |
|
445 | 445 | shelfname = pats[0] |
|
446 | 446 | |
|
447 | 447 | if not shelvedfile(repo, shelfname, 'patch').exists(): |
|
448 |
raise |
|
|
448 | raise error.Abort(_("cannot find shelf %s") % shelfname) | |
|
449 | 449 | |
|
450 | 450 | listcmd(ui, repo, pats, opts) |
|
451 | 451 | |
|
452 | 452 | def checkparents(repo, state): |
|
453 | 453 | """check parent while resuming an unshelve""" |
|
454 | 454 | if state.parents != repo.dirstate.parents(): |
|
455 |
raise |
|
|
455 | raise error.Abort(_('working directory parents do not match unshelve ' | |
|
456 | 456 | 'state')) |
|
457 | 457 | |
|
458 | 458 | def pathtofiles(repo, files): |
@@ -527,7 +527,7 def unshelvecontinue(ui, repo, state, op | |||
|
527 | 527 | checkparents(repo, state) |
|
528 | 528 | ms = merge.mergestate(repo) |
|
529 | 529 | if [f for f in ms if ms[f] == 'u']: |
|
530 |
raise |
|
|
530 | raise error.Abort( | |
|
531 | 531 | _("unresolved conflicts, can't continue"), |
|
532 | 532 | hint=_("see 'hg resolve', then 'hg unshelve --continue'")) |
|
533 | 533 | |
@@ -610,9 +610,9 def unshelve(ui, repo, *shelved, **opts) | |||
|
610 | 610 | |
|
611 | 611 | if abortf or continuef: |
|
612 | 612 | if abortf and continuef: |
|
613 |
raise |
|
|
613 | raise error.Abort(_('cannot use both abort and continue')) | |
|
614 | 614 | if shelved: |
|
615 |
raise |
|
|
615 | raise error.Abort(_('cannot combine abort/continue with ' | |
|
616 | 616 | 'naming a shelved change')) |
|
617 | 617 | |
|
618 | 618 | try: |
@@ -620,25 +620,25 def unshelve(ui, repo, *shelved, **opts) | |||
|
620 | 620 | except IOError as err: |
|
621 | 621 | if err.errno != errno.ENOENT: |
|
622 | 622 | raise |
|
623 |
raise |
|
|
623 | raise error.Abort(_('no unshelve operation underway')) | |
|
624 | 624 | |
|
625 | 625 | if abortf: |
|
626 | 626 | return unshelveabort(ui, repo, state, opts) |
|
627 | 627 | elif continuef: |
|
628 | 628 | return unshelvecontinue(ui, repo, state, opts) |
|
629 | 629 | elif len(shelved) > 1: |
|
630 |
raise |
|
|
630 | raise error.Abort(_('can only unshelve one change at a time')) | |
|
631 | 631 | elif not shelved: |
|
632 | 632 | shelved = listshelves(repo) |
|
633 | 633 | if not shelved: |
|
634 |
raise |
|
|
634 | raise error.Abort(_('no shelved changes to apply!')) | |
|
635 | 635 | basename = util.split(shelved[0][1])[1] |
|
636 | 636 | ui.status(_("unshelving change '%s'\n") % basename) |
|
637 | 637 | else: |
|
638 | 638 | basename = shelved[0] |
|
639 | 639 | |
|
640 | 640 | if not shelvedfile(repo, basename, 'patch').exists(): |
|
641 |
raise |
|
|
641 | raise error.Abort(_("shelved change '%s' not found") % basename) | |
|
642 | 642 | |
|
643 | 643 | oldquiet = ui.quiet |
|
644 | 644 | wlock = lock = tr = None |
@@ -808,12 +808,12 def shelvecmd(ui, repo, *pats, **opts): | |||
|
808 | 808 | if opts[opt]: |
|
809 | 809 | for i, allowable in allowables: |
|
810 | 810 | if opts[i] and opt not in allowable: |
|
811 |
raise |
|
|
811 | raise error.Abort(_("options '--%s' and '--%s' may not be " | |
|
812 | 812 | "used together") % (opt, i)) |
|
813 | 813 | return True |
|
814 | 814 | if checkopt('cleanup'): |
|
815 | 815 | if pats: |
|
816 |
raise |
|
|
816 | raise error.Abort(_("cannot specify names when using '--cleanup'")) | |
|
817 | 817 | return cleanupcmd(ui, repo) |
|
818 | 818 | elif checkopt('delete'): |
|
819 | 819 | return deletecmd(ui, repo, pats) |
@@ -6,7 +6,7 repository. See the command help for det | |||
|
6 | 6 | from mercurial.i18n import _ |
|
7 | 7 | from mercurial.node import nullid |
|
8 | 8 | from mercurial.lock import release |
|
9 | from mercurial import cmdutil, hg, scmutil, util | |
|
9 | from mercurial import cmdutil, hg, scmutil, util, error | |
|
10 | 10 | from mercurial import repair, bookmarks, merge |
|
11 | 11 | |
|
12 | 12 | cmdtable = {} |
@@ -38,10 +38,10 def checklocalchanges(repo, force=False, | |||
|
38 | 38 | if not force: |
|
39 | 39 | if s.modified or s.added or s.removed or s.deleted: |
|
40 | 40 | _("local changes found") # i18n tool detection |
|
41 |
raise |
|
|
41 | raise error.Abort(_("local changes found" + excsuffix)) | |
|
42 | 42 | if checksubstate(repo): |
|
43 | 43 | _("local changed subrepos found") # i18n tool detection |
|
44 |
raise |
|
|
44 | raise error.Abort(_("local changed subrepos found" + excsuffix)) | |
|
45 | 45 | return s |
|
46 | 46 | |
|
47 | 47 | def strip(ui, repo, revs, update=True, backup=True, force=None, bookmark=None): |
@@ -131,7 +131,7 def stripcmd(ui, repo, *revs, **opts): | |||
|
131 | 131 | mark = opts.get('bookmark') |
|
132 | 132 | marks = repo._bookmarks |
|
133 | 133 | if mark not in marks: |
|
134 |
raise |
|
|
134 | raise error.Abort(_("bookmark '%s' not found") % mark) | |
|
135 | 135 | |
|
136 | 136 | # If the requested bookmark is not the only one pointing to a |
|
137 | 137 | # a revision we have to only delete the bookmark and not strip |
@@ -153,7 +153,7 def stripcmd(ui, repo, *revs, **opts): | |||
|
153 | 153 | ui.write(_("bookmark '%s' deleted\n") % mark) |
|
154 | 154 | |
|
155 | 155 | if not revs: |
|
156 |
raise |
|
|
156 | raise error.Abort(_('empty revision set')) | |
|
157 | 157 | |
|
158 | 158 | descendants = set(cl.descendants(revs)) |
|
159 | 159 | strippedrevs = revs.union(descendants) |
@@ -174,7 +174,7 class transplanter(object): | |||
|
174 | 174 | else: |
|
175 | 175 | parent = source.lookup(opts['parent']) |
|
176 | 176 | if parent not in parents: |
|
177 |
raise |
|
|
177 | raise error.Abort(_('%s is not a parent of %s') % | |
|
178 | 178 | (short(parent), short(node))) |
|
179 | 179 | else: |
|
180 | 180 | parent = parents[0] |
@@ -245,7 +245,7 class transplanter(object): | |||
|
245 | 245 | environ={'HGUSER': changelog[1], |
|
246 | 246 | 'HGREVISION': revlog.hex(node), |
|
247 | 247 | }, |
|
248 |
onerr= |
|
|
248 | onerr=error.Abort, errprefix=_('filter failed')) | |
|
249 | 249 | user, date, msg = self.parselog(file(headerfile))[1:4] |
|
250 | 250 | finally: |
|
251 | 251 | os.unlink(headerfile) |
@@ -269,7 +269,7 class transplanter(object): | |||
|
269 | 269 | self.ui.note('%s %s\n%s\n' % (user, date, message)) |
|
270 | 270 | |
|
271 | 271 | if not patchfile and not merge: |
|
272 |
raise |
|
|
272 | raise error.Abort(_('can only omit patchfile if merging')) | |
|
273 | 273 | if patchfile: |
|
274 | 274 | try: |
|
275 | 275 | files = set() |
@@ -332,14 +332,14 class transplanter(object): | |||
|
332 | 332 | merge = False |
|
333 | 333 | |
|
334 | 334 | if not user or not date or not message or not parents[0]: |
|
335 |
raise |
|
|
335 | raise error.Abort(_('transplant log file is corrupt')) | |
|
336 | 336 | |
|
337 | 337 | parent = parents[0] |
|
338 | 338 | if len(parents) > 1: |
|
339 | 339 | if opts.get('parent'): |
|
340 | 340 | parent = source.lookup(opts['parent']) |
|
341 | 341 | if parent not in parents: |
|
342 |
raise |
|
|
342 | raise error.Abort(_('%s is not a parent of %s') % | |
|
343 | 343 | (short(parent), short(node))) |
|
344 | 344 | else: |
|
345 | 345 | merge = True |
@@ -349,7 +349,7 class transplanter(object): | |||
|
349 | 349 | try: |
|
350 | 350 | p1, p2 = repo.dirstate.parents() |
|
351 | 351 | if p1 != parent: |
|
352 |
raise |
|
|
352 | raise error.Abort(_('working directory not at transplant ' | |
|
353 | 353 | 'parent %s') % revlog.hex(parent)) |
|
354 | 354 | if merge: |
|
355 | 355 | repo.setparents(p1, parents[1]) |
@@ -358,7 +358,7 class transplanter(object): | |||
|
358 | 358 | n = repo.commit(message, user, date, extra=extra, |
|
359 | 359 | editor=self.getcommiteditor()) |
|
360 | 360 | if not n: |
|
361 |
raise |
|
|
361 | raise error.Abort(_('commit failed')) | |
|
362 | 362 | if not merge: |
|
363 | 363 | self.transplants.set(n, node) |
|
364 | 364 | else: |
@@ -418,7 +418,7 class transplanter(object): | |||
|
418 | 418 | inmsg = True |
|
419 | 419 | message.append(line) |
|
420 | 420 | if None in (user, date): |
|
421 |
raise |
|
|
421 | raise error.Abort(_("filter corrupted changeset (no user or date)")) | |
|
422 | 422 | return (node, user, date, '\n'.join(message), parents) |
|
423 | 423 | |
|
424 | 424 | def log(self, user, date, message, p1, p2, merge=False): |
@@ -594,18 +594,18 def transplant(ui, repo, *revs, **opts): | |||
|
594 | 594 | def checkopts(opts, revs): |
|
595 | 595 | if opts.get('continue'): |
|
596 | 596 | if opts.get('branch') or opts.get('all') or opts.get('merge'): |
|
597 |
raise |
|
|
597 | raise error.Abort(_('--continue is incompatible with ' | |
|
598 | 598 | '--branch, --all and --merge')) |
|
599 | 599 | return |
|
600 | 600 | if not (opts.get('source') or revs or |
|
601 | 601 | opts.get('merge') or opts.get('branch')): |
|
602 |
raise |
|
|
602 | raise error.Abort(_('no source URL, branch revision or revision ' | |
|
603 | 603 | 'list provided')) |
|
604 | 604 | if opts.get('all'): |
|
605 | 605 | if not opts.get('branch'): |
|
606 |
raise |
|
|
606 | raise error.Abort(_('--all requires a branch revision')) | |
|
607 | 607 | if revs: |
|
608 |
raise |
|
|
608 | raise error.Abort(_('--all is incompatible with a ' | |
|
609 | 609 | 'revision list')) |
|
610 | 610 | |
|
611 | 611 | checkopts(opts, revs) |
@@ -622,13 +622,13 def transplant(ui, repo, *revs, **opts): | |||
|
622 | 622 | cmdutil.checkunfinished(repo) |
|
623 | 623 | p1, p2 = repo.dirstate.parents() |
|
624 | 624 | if len(repo) > 0 and p1 == revlog.nullid: |
|
625 |
raise |
|
|
625 | raise error.Abort(_('no revision checked out')) | |
|
626 | 626 | if not opts.get('continue'): |
|
627 | 627 | if p2 != revlog.nullid: |
|
628 |
raise |
|
|
628 | raise error.Abort(_('outstanding uncommitted merges')) | |
|
629 | 629 | m, a, r, d = repo.status()[:4] |
|
630 | 630 | if m or a or r or d: |
|
631 |
raise |
|
|
631 | raise error.Abort(_('outstanding local changes')) | |
|
632 | 632 | |
|
633 | 633 | sourcerepo = opts.get('source') |
|
634 | 634 | if sourcerepo: |
@@ -47,7 +47,7 It is useful for the users who want to c | |||
|
47 | 47 | |
|
48 | 48 | import os, sys |
|
49 | 49 | from mercurial.i18n import _ |
|
50 |
from mercurial import |
|
|
50 | from mercurial import error, encoding | |
|
51 | 51 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
|
52 | 52 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
53 | 53 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -105,7 +105,7 def basewrapper(func, argtype, enc, dec, | |||
|
105 | 105 | # return value. |
|
106 | 106 | return enc(func(*dec(args), **dec(kwds))) |
|
107 | 107 | except UnicodeError: |
|
108 |
raise |
|
|
108 | raise error.Abort(_("[win32mbcs] filename conversion failed with" | |
|
109 | 109 | " %s encoding\n") % (_encoding)) |
|
110 | 110 | |
|
111 | 111 | def wrapper(func, args, kwds): |
@@ -55,7 +55,7 def tidyprefix(dest, kind, prefix): | |||
|
55 | 55 | if prefix.startswith('./'): |
|
56 | 56 | prefix = prefix[2:] |
|
57 | 57 | if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: |
|
58 |
raise |
|
|
58 | raise error.Abort(_('archive prefix contains illegal components')) | |
|
59 | 59 | return prefix |
|
60 | 60 | |
|
61 | 61 | exts = { |
@@ -292,7 +292,7 def archive(repo, dest, node, kind, deco | |||
|
292 | 292 | |
|
293 | 293 | if kind == 'files': |
|
294 | 294 | if prefix: |
|
295 |
raise |
|
|
295 | raise error.Abort(_('cannot give prefix when archiving to files')) | |
|
296 | 296 | else: |
|
297 | 297 | prefix = tidyprefix(dest, kind, prefix) |
|
298 | 298 | |
@@ -303,7 +303,7 def archive(repo, dest, node, kind, deco | |||
|
303 | 303 | archiver.addfile(prefix + name, mode, islink, data) |
|
304 | 304 | |
|
305 | 305 | if kind not in archivers: |
|
306 |
raise |
|
|
306 | raise error.Abort(_("unknown archive type '%s'") % kind) | |
|
307 | 307 | |
|
308 | 308 | ctx = repo[node] |
|
309 | 309 | archiver = archivers[kind](dest, mtime or ctx.date()[0]) |
@@ -19,8 +19,8 from .node import ( | |||
|
19 | 19 | ) |
|
20 | 20 | from . import ( |
|
21 | 21 | encoding, |
|
22 | error, | |
|
22 | 23 | scmutil, |
|
23 | util, | |
|
24 | 24 | ) |
|
25 | 25 | |
|
26 | 26 | array = array.array |
@@ -250,7 +250,7 class branchcache(dict): | |||
|
250 | 250 | repo.ui.log('branchcache', |
|
251 | 251 | 'wrote %s branch cache with %d labels and %d nodes\n', |
|
252 | 252 | repo.filtername, len(self), nodecount) |
|
253 |
except (IOError, OSError, |
|
|
253 | except (IOError, OSError, error.Abort) as inst: | |
|
254 | 254 | repo.ui.debug("couldn't write branch cache: %s\n" % inst) |
|
255 | 255 | # Abort may be raise by read only opener |
|
256 | 256 | pass |
@@ -465,7 +465,7 class revbranchcache(object): | |||
|
465 | 465 | for b in self._names[self._rbcnamescount:])) |
|
466 | 466 | self._rbcsnameslen = f.tell() |
|
467 | 467 | f.close() |
|
468 |
except (IOError, OSError, |
|
|
468 | except (IOError, OSError, error.Abort) as inst: | |
|
469 | 469 | repo.ui.debug("couldn't write revision branch cache names: " |
|
470 | 470 | "%s\n" % inst) |
|
471 | 471 | return |
@@ -483,7 +483,7 class revbranchcache(object): | |||
|
483 | 483 | end = revs * _rbcrecsize |
|
484 | 484 | f.write(self._rbcrevs[start:end]) |
|
485 | 485 | f.close() |
|
486 |
except (IOError, OSError, |
|
|
486 | except (IOError, OSError, error.Abort) as inst: | |
|
487 | 487 | repo.ui.debug("couldn't write revision branch cache: %s\n" % |
|
488 | 488 | inst) |
|
489 | 489 | return |
@@ -627,10 +627,10 def getunbundler(ui, fp, magicstring=Non | |||
|
627 | 627 | magicstring = changegroup.readexactly(fp, 4) |
|
628 | 628 | magic, version = magicstring[0:2], magicstring[2:4] |
|
629 | 629 | if magic != 'HG': |
|
630 |
raise |
|
|
630 | raise error.Abort(_('not a Mercurial bundle')) | |
|
631 | 631 | unbundlerclass = formatmap.get(version) |
|
632 | 632 | if unbundlerclass is None: |
|
633 |
raise |
|
|
633 | raise error.Abort(_('unknown bundle version %s') % version) | |
|
634 | 634 | unbundler = unbundlerclass(ui, fp) |
|
635 | 635 | indebug(ui, 'start processing of %s stream' % magicstring) |
|
636 | 636 | return unbundler |
@@ -1206,7 +1206,7 class unbundlepart(unpackermixin): | |||
|
1206 | 1206 | self._payloadstream = util.chunkbuffer(self._payloadchunks(chunk)) |
|
1207 | 1207 | adjust = self.read(internaloffset) |
|
1208 | 1208 | if len(adjust) != internaloffset: |
|
1209 |
raise |
|
|
1209 | raise error.Abort(_('Seek failed\n')) | |
|
1210 | 1210 | self._pos = newpos |
|
1211 | 1211 | |
|
1212 | 1212 | # These are only the static capabilities. |
@@ -1304,19 +1304,19 def handleremotechangegroup(op, inpart): | |||
|
1304 | 1304 | try: |
|
1305 | 1305 | raw_url = inpart.params['url'] |
|
1306 | 1306 | except KeyError: |
|
1307 |
raise |
|
|
1307 | raise error.Abort(_('remote-changegroup: missing "%s" param') % 'url') | |
|
1308 | 1308 | parsed_url = util.url(raw_url) |
|
1309 | 1309 | if parsed_url.scheme not in capabilities['remote-changegroup']: |
|
1310 |
raise |
|
|
1310 | raise error.Abort(_('remote-changegroup does not support %s urls') % | |
|
1311 | 1311 | parsed_url.scheme) |
|
1312 | 1312 | |
|
1313 | 1313 | try: |
|
1314 | 1314 | size = int(inpart.params['size']) |
|
1315 | 1315 | except ValueError: |
|
1316 |
raise |
|
|
1316 | raise error.Abort(_('remote-changegroup: invalid value for param "%s"') | |
|
1317 | 1317 | % 'size') |
|
1318 | 1318 | except KeyError: |
|
1319 |
raise |
|
|
1319 | raise error.Abort(_('remote-changegroup: missing "%s" param') % 'size') | |
|
1320 | 1320 | |
|
1321 | 1321 | digests = {} |
|
1322 | 1322 | for typ in inpart.params.get('digests', '').split(): |
@@ -1324,7 +1324,7 def handleremotechangegroup(op, inpart): | |||
|
1324 | 1324 | try: |
|
1325 | 1325 | value = inpart.params[param] |
|
1326 | 1326 | except KeyError: |
|
1327 |
raise |
|
|
1327 | raise error.Abort(_('remote-changegroup: missing "%s" param') % | |
|
1328 | 1328 | param) |
|
1329 | 1329 | digests[typ] = value |
|
1330 | 1330 | |
@@ -1339,7 +1339,7 def handleremotechangegroup(op, inpart): | |||
|
1339 | 1339 | from . import exchange |
|
1340 | 1340 | cg = exchange.readbundle(op.repo.ui, real_part, raw_url) |
|
1341 | 1341 | if not isinstance(cg, changegroup.cg1unpacker): |
|
1342 |
raise |
|
|
1342 | raise error.Abort(_('%s: not a bundle version 1.0') % | |
|
1343 | 1343 | util.hidepassword(raw_url)) |
|
1344 | 1344 | ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') |
|
1345 | 1345 | op.records.add('changegroup', {'return': ret}) |
@@ -1351,8 +1351,8 def handleremotechangegroup(op, inpart): | |||
|
1351 | 1351 | part.addparam('return', '%i' % ret, mandatory=False) |
|
1352 | 1352 | try: |
|
1353 | 1353 | real_part.validate() |
|
1354 |
except |
|
|
1355 |
raise |
|
|
1354 | except error.Abort as e: | |
|
1355 | raise error.Abort(_('bundle at %s is corrupted:\n%s') % | |
|
1356 | 1356 | (util.hidepassword(raw_url), str(e))) |
|
1357 | 1357 | assert not inpart.read() |
|
1358 | 1358 | |
@@ -1399,7 +1399,7 def handlereplycaps(op, inpart): | |||
|
1399 | 1399 | @parthandler('error:abort', ('message', 'hint')) |
|
1400 | 1400 | def handleerrorabort(op, inpart): |
|
1401 | 1401 | """Used to transmit abort error over the wire""" |
|
1402 |
raise |
|
|
1402 | raise error.Abort(inpart.params['message'], hint=inpart.params.get('hint')) | |
|
1403 | 1403 | |
|
1404 | 1404 | @parthandler('error:pushkey', ('namespace', 'key', 'new', 'old', 'ret', |
|
1405 | 1405 | 'in-reply-to')) |
@@ -282,7 +282,7 class bundlerepository(localrepo.localre | |||
|
282 | 282 | in changegroup.packermap)] |
|
283 | 283 | |
|
284 | 284 | if not cgparts: |
|
285 |
raise |
|
|
285 | raise error.Abort('No changegroups found') | |
|
286 | 286 | version = cgparts[0].params.get('version', '01') |
|
287 | 287 | cgparts = [p for p in cgparts |
|
288 | 288 | if p.params.get('version', '01') == version] |
@@ -374,7 +374,7 class bundlerepository(localrepo.localre | |||
|
374 | 374 | |
|
375 | 375 | def instance(ui, path, create): |
|
376 | 376 | if create: |
|
377 |
raise |
|
|
377 | raise error.Abort(_('cannot create new bundle repository')) | |
|
378 | 378 | # internal config: bundle.mainreporoot |
|
379 | 379 | parentpath = ui.config("bundle", "mainreporoot", "") |
|
380 | 380 | if not parentpath: |
@@ -37,7 +37,7 def readexactly(stream, n): | |||
|
37 | 37 | '''read n bytes from stream.read and abort if less was available''' |
|
38 | 38 | s = stream.read(n) |
|
39 | 39 | if len(s) < n: |
|
40 |
raise |
|
|
40 | raise error.Abort(_("stream ended unexpectedly" | |
|
41 | 41 | " (got %d bytes, expected %d)") |
|
42 | 42 | % (len(s), n)) |
|
43 | 43 | return s |
@@ -48,7 +48,7 def getchunk(stream): | |||
|
48 | 48 | l = struct.unpack(">l", d)[0] |
|
49 | 49 | if l <= 4: |
|
50 | 50 | if l: |
|
51 |
raise |
|
|
51 | raise error.Abort(_("invalid chunk length %d") % l) | |
|
52 | 52 | return "" |
|
53 | 53 | return readexactly(stream, l - 4) |
|
54 | 54 | |
@@ -144,11 +144,11 def writebundle(ui, cg, filename, bundle | |||
|
144 | 144 | # compression argument is only for the bundle2 case |
|
145 | 145 | assert compression is None |
|
146 | 146 | if cg.version != '01': |
|
147 |
raise |
|
|
147 | raise error.Abort(_('old bundle types only supports v1 ' | |
|
148 | 148 | 'changegroups')) |
|
149 | 149 | header, comp = bundletypes[bundletype] |
|
150 | 150 | if comp not in util.compressors: |
|
151 |
raise |
|
|
151 | raise error.Abort(_('unknown stream compression type: %s') | |
|
152 | 152 | % comp) |
|
153 | 153 | z = util.compressors[comp]() |
|
154 | 154 | subchunkiter = cg.getchunks() |
@@ -175,7 +175,7 class cg1unpacker(object): | |||
|
175 | 175 | if alg == 'UN': |
|
176 | 176 | alg = None # get more modern without breaking too much |
|
177 | 177 | if not alg in util.decompressors: |
|
178 |
raise |
|
|
178 | raise error.Abort(_('unknown stream compression type: %s') | |
|
179 | 179 | % alg) |
|
180 | 180 | if alg == 'BZ': |
|
181 | 181 | alg = '_truncatedBZ' |
@@ -198,7 +198,7 class cg1unpacker(object): | |||
|
198 | 198 | l = struct.unpack(">l", d)[0] |
|
199 | 199 | if l <= 4: |
|
200 | 200 | if l: |
|
201 |
raise |
|
|
201 | raise error.Abort(_("invalid chunk length %d") % l) | |
|
202 | 202 | return 0 |
|
203 | 203 | if self.callback: |
|
204 | 204 | self.callback() |
@@ -477,7 +477,7 class cg1packer(object): | |||
|
477 | 477 | for i, fname in enumerate(sorted(changedfiles)): |
|
478 | 478 | filerevlog = repo.file(fname) |
|
479 | 479 | if not filerevlog: |
|
480 |
raise |
|
|
480 | raise error.Abort(_("empty or missing revlog for %s") % fname) | |
|
481 | 481 | |
|
482 | 482 | linkrevnodes = linknodes(filerevlog, fname) |
|
483 | 483 | # Lookup for filenodes, we collected the linkrev nodes above in the |
@@ -688,9 +688,9 def addchangegroupfiles(repo, source, re | |||
|
688 | 688 | o = len(fl) |
|
689 | 689 | try: |
|
690 | 690 | if not fl.addgroup(source, revmap, trp): |
|
691 |
raise |
|
|
691 | raise error.Abort(_("received file revlog group is empty")) | |
|
692 | 692 | except error.CensoredBaseError as e: |
|
693 |
raise |
|
|
693 | raise error.Abort(_("received delta base is censored: %s") % e) | |
|
694 | 694 | revisions += len(fl) - o |
|
695 | 695 | files += 1 |
|
696 | 696 | if f in needfiles: |
@@ -700,7 +700,7 def addchangegroupfiles(repo, source, re | |||
|
700 | 700 | if n in needs: |
|
701 | 701 | needs.remove(n) |
|
702 | 702 | else: |
|
703 |
raise |
|
|
703 | raise error.Abort( | |
|
704 | 704 | _("received spurious file revlog entry")) |
|
705 | 705 | if not needs: |
|
706 | 706 | del needfiles[f] |
@@ -712,7 +712,7 def addchangegroupfiles(repo, source, re | |||
|
712 | 712 | try: |
|
713 | 713 | fl.rev(n) |
|
714 | 714 | except error.LookupError: |
|
715 |
raise |
|
|
715 | raise error.Abort( | |
|
716 | 716 | _('missing file data for %s:%s - run hg verify') % |
|
717 | 717 | (f, hex(n))) |
|
718 | 718 | |
@@ -784,7 +784,7 def addchangegroup(repo, source, srctype | |||
|
784 | 784 | efiles = len(efiles) |
|
785 | 785 | |
|
786 | 786 | if not (srccontent or emptyok): |
|
787 |
raise |
|
|
787 | raise error.Abort(_("received changelog group is empty")) | |
|
788 | 788 | clend = len(cl) |
|
789 | 789 | changesets = clend - clstart |
|
790 | 790 | repo.ui.progress(_('changesets'), None) |
@@ -85,7 +85,7 def dorecord(ui, repo, commitfunc, cmdsu | |||
|
85 | 85 | msg = _('running non-interactively, use %s instead') % cmdsuggest |
|
86 | 86 | else: |
|
87 | 87 | msg = _('running non-interactively') |
|
88 |
raise |
|
|
88 | raise error.Abort(msg) | |
|
89 | 89 | |
|
90 | 90 | # make sure username is set before going interactive |
|
91 | 91 | if not opts.get('user'): |
@@ -109,7 +109,7 def dorecord(ui, repo, commitfunc, cmdsu | |||
|
109 | 109 | checkunfinished(repo, commit=True) |
|
110 | 110 | merge = len(repo[None].parents()) > 1 |
|
111 | 111 | if merge: |
|
112 |
raise |
|
|
112 | raise error.Abort(_('cannot partially commit a merge ' | |
|
113 | 113 | '(use "hg commit" instead)')) |
|
114 | 114 | |
|
115 | 115 | status = repo.status(match=match) |
@@ -123,7 +123,7 def dorecord(ui, repo, commitfunc, cmdsu | |||
|
123 | 123 | try: |
|
124 | 124 | chunks = filterfn(ui, originalchunks) |
|
125 | 125 | except patch.PatchError as err: |
|
126 |
raise |
|
|
126 | raise error.Abort(_('error parsing patch: %s') % err) | |
|
127 | 127 | |
|
128 | 128 | # We need to keep a backup of files that have been newly added and |
|
129 | 129 | # modified during the recording process because there is a previous |
@@ -193,7 +193,7 def dorecord(ui, repo, commitfunc, cmdsu | |||
|
193 | 193 | ui.debug(fp.getvalue()) |
|
194 | 194 | patch.internalpatch(ui, repo, fp, 1, eolmode=None) |
|
195 | 195 | except patch.PatchError as err: |
|
196 |
raise |
|
|
196 | raise error.Abort(str(err)) | |
|
197 | 197 | del fp |
|
198 | 198 | |
|
199 | 199 | # 4. We prepared working directory according to filtered |
@@ -305,10 +305,10 def findrepo(p): | |||
|
305 | 305 | |
|
306 | 306 | def bailifchanged(repo, merge=True): |
|
307 | 307 | if merge and repo.dirstate.p2() != nullid: |
|
308 |
raise |
|
|
308 | raise error.Abort(_('outstanding uncommitted merge')) | |
|
309 | 309 | modified, added, removed, deleted = repo.status()[:4] |
|
310 | 310 | if modified or added or removed or deleted: |
|
311 |
raise |
|
|
311 | raise error.Abort(_('uncommitted changes')) | |
|
312 | 312 | ctx = repo[None] |
|
313 | 313 | for s in sorted(ctx.substate): |
|
314 | 314 | ctx.sub(s).bailifchanged() |
@@ -319,7 +319,7 def logmessage(ui, opts): | |||
|
319 | 319 | logfile = opts.get('logfile') |
|
320 | 320 | |
|
321 | 321 | if message and logfile: |
|
322 |
raise |
|
|
322 | raise error.Abort(_('options --message and --logfile are mutually ' | |
|
323 | 323 | 'exclusive')) |
|
324 | 324 | if not message and logfile: |
|
325 | 325 | try: |
@@ -328,7 +328,7 def logmessage(ui, opts): | |||
|
328 | 328 | else: |
|
329 | 329 | message = '\n'.join(util.readfile(logfile).splitlines()) |
|
330 | 330 | except IOError as inst: |
|
331 |
raise |
|
|
331 | raise error.Abort(_("can't read commit message '%s': %s") % | |
|
332 | 332 | (logfile, inst.strerror)) |
|
333 | 333 | return message |
|
334 | 334 | |
@@ -387,9 +387,9 def loglimit(opts): | |||
|
387 | 387 | try: |
|
388 | 388 | limit = int(limit) |
|
389 | 389 | except ValueError: |
|
390 |
raise |
|
|
390 | raise error.Abort(_('limit must be a positive integer')) | |
|
391 | 391 | if limit <= 0: |
|
392 |
raise |
|
|
392 | raise error.Abort(_('limit must be positive')) | |
|
393 | 393 | else: |
|
394 | 394 | limit = None |
|
395 | 395 | return limit |
@@ -437,7 +437,7 def makefilename(repo, pat, node, desc=N | |||
|
437 | 437 | i += 1 |
|
438 | 438 | return ''.join(newname) |
|
439 | 439 | except KeyError as inst: |
|
440 |
raise |
|
|
440 | raise error.Abort(_("invalid format spec '%%%s' in output filename") % | |
|
441 | 441 | inst.args[0]) |
|
442 | 442 | |
|
443 | 443 | def makefileobj(repo, pat, node=None, desc=None, total=None, |
@@ -495,7 +495,7 def openrevlog(repo, cmd, file_, opts): | |||
|
495 | 495 | msg = _('cannot specify --changelog or --manifest or --dir ' |
|
496 | 496 | 'without a repository') |
|
497 | 497 | if msg: |
|
498 |
raise |
|
|
498 | raise error.Abort(msg) | |
|
499 | 499 | |
|
500 | 500 | r = None |
|
501 | 501 | if repo: |
@@ -503,7 +503,7 def openrevlog(repo, cmd, file_, opts): | |||
|
503 | 503 | r = repo.unfiltered().changelog |
|
504 | 504 | elif dir: |
|
505 | 505 | if 'treemanifest' not in repo.requirements: |
|
506 |
raise |
|
|
506 | raise error.Abort(_("--dir can only be used on repos with " | |
|
507 | 507 | "treemanifest enabled")) |
|
508 | 508 | dirlog = repo.dirlog(file_) |
|
509 | 509 | if len(dirlog): |
@@ -518,7 +518,7 def openrevlog(repo, cmd, file_, opts): | |||
|
518 | 518 | if not file_: |
|
519 | 519 | raise error.CommandError(cmd, _('invalid arguments')) |
|
520 | 520 | if not os.path.isfile(file_): |
|
521 |
raise |
|
|
521 | raise error.Abort(_("revlog '%s' not found") % file_) | |
|
522 | 522 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), |
|
523 | 523 | file_[:-2] + ".i") |
|
524 | 524 | return r |
@@ -716,17 +716,17 def copy(ui, repo, pats, opts, rename=Fa | |||
|
716 | 716 | |
|
717 | 717 | pats = scmutil.expandpats(pats) |
|
718 | 718 | if not pats: |
|
719 |
raise |
|
|
719 | raise error.Abort(_('no source or destination specified')) | |
|
720 | 720 | if len(pats) == 1: |
|
721 |
raise |
|
|
721 | raise error.Abort(_('no destination specified')) | |
|
722 | 722 | dest = pats.pop() |
|
723 | 723 | destdirexists = os.path.isdir(dest) and not os.path.islink(dest) |
|
724 | 724 | if not destdirexists: |
|
725 | 725 | if len(pats) > 1 or matchmod.patkind(pats[0]): |
|
726 |
raise |
|
|
726 | raise error.Abort(_('with multiple sources, destination must be an ' | |
|
727 | 727 | 'existing directory')) |
|
728 | 728 | if util.endswithsep(dest): |
|
729 |
raise |
|
|
729 | raise error.Abort(_('destination %s is not a directory') % dest) | |
|
730 | 730 | |
|
731 | 731 | tfn = targetpathfn |
|
732 | 732 | if after: |
@@ -738,7 +738,7 def copy(ui, repo, pats, opts, rename=Fa | |||
|
738 | 738 | continue |
|
739 | 739 | copylist.append((tfn(pat, dest, srcs), srcs)) |
|
740 | 740 | if not copylist: |
|
741 |
raise |
|
|
741 | raise error.Abort(_('no files to copy')) | |
|
742 | 742 | |
|
743 | 743 | errors = 0 |
|
744 | 744 | for targetpath, srcs in copylist: |
@@ -786,7 +786,7 def service(opts, parentfn=None, initfn= | |||
|
786 | 786 | return not os.path.exists(lockpath) |
|
787 | 787 | pid = util.rundetached(runargs, condfn) |
|
788 | 788 | if pid < 0: |
|
789 |
raise |
|
|
789 | raise error.Abort(_('child process failed to start')) | |
|
790 | 790 | writepid(pid) |
|
791 | 791 | finally: |
|
792 | 792 | try: |
@@ -908,7 +908,7 def tryimportone(ui, repo, hunk, parents | |||
|
908 | 908 | parents.append(repo[nullid]) |
|
909 | 909 | if opts.get('exact'): |
|
910 | 910 | if not nodeid or not p1: |
|
911 |
raise |
|
|
911 | raise error.Abort(_('not a Mercurial patch')) | |
|
912 | 912 | p1 = repo[p1] |
|
913 | 913 | p2 = repo[p2 or nullid] |
|
914 | 914 | elif p2: |
@@ -946,7 +946,7 def tryimportone(ui, repo, hunk, parents | |||
|
946 | 946 | files=files, eolmode=None, similarity=sim / 100.0) |
|
947 | 947 | except patch.PatchError as e: |
|
948 | 948 | if not partial: |
|
949 |
raise |
|
|
949 | raise error.Abort(str(e)) | |
|
950 | 950 | if partial: |
|
951 | 951 | rejects = True |
|
952 | 952 | |
@@ -993,7 +993,7 def tryimportone(ui, repo, hunk, parents | |||
|
993 | 993 | patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix, |
|
994 | 994 | files, eolmode=None) |
|
995 | 995 | except patch.PatchError as e: |
|
996 |
raise |
|
|
996 | raise error.Abort(str(e)) | |
|
997 | 997 | if opts.get('exact'): |
|
998 | 998 | editor = None |
|
999 | 999 | else: |
@@ -1012,7 +1012,7 def tryimportone(ui, repo, hunk, parents | |||
|
1012 | 1012 | # and branch bits |
|
1013 | 1013 | ui.warn(_("warning: can't check exact import with --no-commit\n")) |
|
1014 | 1014 | elif opts.get('exact') and hex(n) != nodeid: |
|
1015 |
raise |
|
|
1015 | raise error.Abort(_('patch is damaged or loses information')) | |
|
1016 | 1016 | if n: |
|
1017 | 1017 | # i18n: refers to a short changeset id |
|
1018 | 1018 | msg = _('created %s') % short(n) |
@@ -1500,9 +1500,9 class changeset_templater(changeset_prin | |||
|
1500 | 1500 | self.t(self._parts['footer'], **props)) |
|
1501 | 1501 | except KeyError as inst: |
|
1502 | 1502 | msg = _("%s: no key named '%s'") |
|
1503 |
raise |
|
|
1503 | raise error.Abort(msg % (self.t.mapfile, inst.args[0])) | |
|
1504 | 1504 | except SyntaxError as inst: |
|
1505 |
raise |
|
|
1505 | raise error.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) | |
|
1506 | 1506 | |
|
1507 | 1507 | def gettemplate(ui, tmpl, style): |
|
1508 | 1508 | """ |
@@ -1563,7 +1563,7 def show_changeset(ui, repo, opts, buffe | |||
|
1563 | 1563 | t = changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, |
|
1564 | 1564 | buffered) |
|
1565 | 1565 | except SyntaxError as inst: |
|
1566 |
raise |
|
|
1566 | raise error.Abort(inst.args[0]) | |
|
1567 | 1567 | return t |
|
1568 | 1568 | |
|
1569 | 1569 | def showmarker(ui, marker): |
@@ -1603,7 +1603,7 def finddate(ui, repo, date): | |||
|
1603 | 1603 | (rev, util.datestr(results[rev]))) |
|
1604 | 1604 | return str(rev) |
|
1605 | 1605 | |
|
1606 |
raise |
|
|
1606 | raise error.Abort(_("revision matching date not found")) | |
|
1607 | 1607 | |
|
1608 | 1608 | def increasingwindows(windowsize=8, sizelimit=512): |
|
1609 | 1609 | while True: |
@@ -1658,7 +1658,7 def walkfilerevs(repo, match, follow, re | |||
|
1658 | 1658 | for filename in match.files(): |
|
1659 | 1659 | if follow: |
|
1660 | 1660 | if filename not in pctx: |
|
1661 |
raise |
|
|
1661 | raise error.Abort(_('cannot follow file not in parent ' | |
|
1662 | 1662 | 'revision: "%s"') % filename) |
|
1663 | 1663 | yield filename, pctx[filename].filenode() |
|
1664 | 1664 | else: |
@@ -1673,7 +1673,7 def walkfilerevs(repo, match, follow, re | |||
|
1673 | 1673 | # A zero count may be a directory or deleted file, so |
|
1674 | 1674 | # try to find matching entries on the slow path. |
|
1675 | 1675 | if follow: |
|
1676 |
raise |
|
|
1676 | raise error.Abort( | |
|
1677 | 1677 | _('cannot follow nonexistent file: "%s"') % file_) |
|
1678 | 1678 | raise FileWalkError("Cannot walk via filelog") |
|
1679 | 1679 | else: |
@@ -1804,7 +1804,7 def walkchangerevs(repo, match, opts, pr | |||
|
1804 | 1804 | # changed files |
|
1805 | 1805 | |
|
1806 | 1806 | if follow: |
|
1807 |
raise |
|
|
1807 | raise error.Abort(_('can only follow copies/renames for explicit ' | |
|
1808 | 1808 | 'filenames')) |
|
1809 | 1809 | |
|
1810 | 1810 | # The slow path checks files modified in every changeset. |
@@ -1976,14 +1976,14 def _makelogrevset(repo, pats, opts, rev | |||
|
1976 | 1976 | slowpath = True |
|
1977 | 1977 | continue |
|
1978 | 1978 | else: |
|
1979 |
raise |
|
|
1979 | raise error.Abort(_('cannot follow file not in parent ' | |
|
1980 | 1980 | 'revision: "%s"') % f) |
|
1981 | 1981 | filelog = repo.file(f) |
|
1982 | 1982 | if not filelog: |
|
1983 | 1983 | # A zero count may be a directory or deleted file, so |
|
1984 | 1984 | # try to find matching entries on the slow path. |
|
1985 | 1985 | if follow: |
|
1986 |
raise |
|
|
1986 | raise error.Abort( | |
|
1987 | 1987 | _('cannot follow nonexistent file: "%s"') % f) |
|
1988 | 1988 | slowpath = True |
|
1989 | 1989 | |
@@ -2207,7 +2207,7 def graphlog(ui, repo, *pats, **opts): | |||
|
2207 | 2207 | def checkunsupportedgraphflags(pats, opts): |
|
2208 | 2208 | for op in ["newest_first"]: |
|
2209 | 2209 | if op in opts and opts[op]: |
|
2210 |
raise |
|
|
2210 | raise error.Abort(_("-G/--graph option is incompatible with --%s") | |
|
2211 | 2211 | % op.replace("_", "-")) |
|
2212 | 2212 | |
|
2213 | 2213 | def graphrevs(repo, nodes, opts): |
@@ -2485,7 +2485,7 def commit(ui, repo, commitfunc, pats, o | |||
|
2485 | 2485 | # that doesn't support addremove |
|
2486 | 2486 | if opts.get('addremove'): |
|
2487 | 2487 | if scmutil.addremove(repo, matcher, "", opts) != 0: |
|
2488 |
raise |
|
|
2488 | raise error.Abort( | |
|
2489 | 2489 | _("failed to mark all new/missing files as added/removed")) |
|
2490 | 2490 | |
|
2491 | 2491 | return commitfunc(ui, repo, message, matcher, opts) |
@@ -2719,7 +2719,7 def commitforceeditor(repo, ctx, subs, f | |||
|
2719 | 2719 | if finishdesc: |
|
2720 | 2720 | text = finishdesc(text) |
|
2721 | 2721 | if not text.strip(): |
|
2722 |
raise |
|
|
2722 | raise error.Abort(_("empty commit message")) | |
|
2723 | 2723 | |
|
2724 | 2724 | return text |
|
2725 | 2725 | |
@@ -2730,7 +2730,7 def buildcommittemplate(repo, ctx, subs, | |||
|
2730 | 2730 | try: |
|
2731 | 2731 | t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) |
|
2732 | 2732 | except SyntaxError as inst: |
|
2733 |
raise |
|
|
2733 | raise error.Abort(inst.args[0]) | |
|
2734 | 2734 | |
|
2735 | 2735 | for k, v in repo.ui.configitems('committemplate'): |
|
2736 | 2736 | if k != 'changeset': |
@@ -3097,7 +3097,7 def revert(ui, repo, ctx, parents, *pats | |||
|
3097 | 3097 | try: |
|
3098 | 3098 | wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) |
|
3099 | 3099 | except KeyError: |
|
3100 |
raise |
|
|
3100 | raise error.Abort("subrepository '%s' does not exist in %s!" | |
|
3101 | 3101 | % (sub, short(ctx.node()))) |
|
3102 | 3102 | finally: |
|
3103 | 3103 | wlock.release() |
@@ -3168,7 +3168,7 def _performrevert(repo, parents, ctx, a | |||
|
3168 | 3168 | chunks = patch.reversehunks(chunks) |
|
3169 | 3169 | |
|
3170 | 3170 | except patch.PatchError as err: |
|
3171 |
raise |
|
|
3171 | raise error.Abort(_('error parsing patch: %s') % err) | |
|
3172 | 3172 | |
|
3173 | 3173 | newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) |
|
3174 | 3174 | # Apply changes |
@@ -3181,7 +3181,7 def _performrevert(repo, parents, ctx, a | |||
|
3181 | 3181 | try: |
|
3182 | 3182 | patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None) |
|
3183 | 3183 | except patch.PatchError as err: |
|
3184 |
raise |
|
|
3184 | raise error.Abort(str(err)) | |
|
3185 | 3185 | del fp |
|
3186 | 3186 | else: |
|
3187 | 3187 | for f in actions['revert'][0]: |
@@ -3302,7 +3302,7 def checkunfinished(repo, commit=False): | |||
|
3302 | 3302 | if commit and allowcommit: |
|
3303 | 3303 | continue |
|
3304 | 3304 | if repo.vfs.exists(f): |
|
3305 |
raise |
|
|
3305 | raise error.Abort(msg, hint=hint) | |
|
3306 | 3306 | |
|
3307 | 3307 | def clearunfinished(repo): |
|
3308 | 3308 | '''Check for unfinished operations (as above), and clear the ones |
@@ -3310,7 +3310,7 def clearunfinished(repo): | |||
|
3310 | 3310 | ''' |
|
3311 | 3311 | for f, clearable, allowcommit, msg, hint in unfinishedstates: |
|
3312 | 3312 | if not clearable and repo.vfs.exists(f): |
|
3313 |
raise |
|
|
3313 | raise error.Abort(msg, hint=hint) | |
|
3314 | 3314 | for f, clearable, allowcommit, msg, hint in unfinishedstates: |
|
3315 | 3315 | if clearable and repo.vfs.exists(f): |
|
3316 | 3316 | util.unlink(repo.join(f)) |
@@ -3349,7 +3349,7 class dirstateguard(object): | |||
|
3349 | 3349 | if not self._active: # already inactivated |
|
3350 | 3350 | msg = (_("can't close already inactivated backup: %s") |
|
3351 | 3351 | % self._filename) |
|
3352 |
raise |
|
|
3352 | raise error.Abort(msg) | |
|
3353 | 3353 | |
|
3354 | 3354 | self._repo.vfs.unlink(self._filename) |
|
3355 | 3355 | self._active = False |
@@ -3368,7 +3368,7 class dirstateguard(object): | |||
|
3368 | 3368 | if not self._active: # already inactivated |
|
3369 | 3369 | msg = (_("can't release already inactivated backup: %s") |
|
3370 | 3370 | % self._filename) |
|
3371 |
raise |
|
|
3371 | raise error.Abort(msg) | |
|
3372 | 3372 | self._abort() |
|
3373 | 3373 | |
|
3374 | 3374 | _bundlecompspecs = {'none': None, |
@@ -3402,7 +3402,7 def parsebundletype(repo, spec): | |||
|
3402 | 3402 | elif spec in _bundleversionspecs: |
|
3403 | 3403 | version = spec |
|
3404 | 3404 | else: |
|
3405 |
raise |
|
|
3405 | raise error.Abort(_('unknown bundle type specified with --type')) | |
|
3406 | 3406 | |
|
3407 | 3407 | if comp is None: |
|
3408 | 3408 | comp = 'BZ' |
@@ -3410,7 +3410,7 def parsebundletype(repo, spec): | |||
|
3410 | 3410 | try: |
|
3411 | 3411 | comp = _bundlecompspecs[comp] |
|
3412 | 3412 | except KeyError: |
|
3413 |
raise |
|
|
3413 | raise error.Abort(_('unknown bundle type specified with --type')) | |
|
3414 | 3414 | |
|
3415 | 3415 | if version is None: |
|
3416 | 3416 | version = '01' |
@@ -3420,6 +3420,6 def parsebundletype(repo, spec): | |||
|
3420 | 3420 | try: |
|
3421 | 3421 | version = _bundleversionspecs[version] |
|
3422 | 3422 | except KeyError: |
|
3423 |
raise |
|
|
3423 | raise error.Abort(_('unknown bundle type specified with --type')) | |
|
3424 | 3424 | |
|
3425 | 3425 | return version, comp |
@@ -238,9 +238,9 def addremove(ui, repo, *pats, **opts): | |||
|
238 | 238 | try: |
|
239 | 239 | sim = float(opts.get('similarity') or 100) |
|
240 | 240 | except ValueError: |
|
241 |
raise |
|
|
241 | raise error.Abort(_('similarity must be a number')) | |
|
242 | 242 | if sim < 0 or sim > 100: |
|
243 |
raise |
|
|
243 | raise error.Abort(_('similarity must be between 0 and 100')) | |
|
244 | 244 | matcher = scmutil.match(repo[None], pats, opts) |
|
245 | 245 | return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) |
|
246 | 246 | |
@@ -276,7 +276,7 def annotate(ui, repo, *pats, **opts): | |||
|
276 | 276 | Returns 0 on success. |
|
277 | 277 | """ |
|
278 | 278 | if not pats: |
|
279 |
raise |
|
|
279 | raise error.Abort(_('at least one filename or pattern is required')) | |
|
280 | 280 | |
|
281 | 281 | if opts.get('follow'): |
|
282 | 282 | # --follow is deprecated and now just an alias for -f/--file |
@@ -333,7 +333,7 def annotate(ui, repo, *pats, **opts): | |||
|
333 | 333 | |
|
334 | 334 | linenumber = opts.get('line_number') is not None |
|
335 | 335 | if linenumber and (not opts.get('changeset')) and (not opts.get('number')): |
|
336 |
raise |
|
|
336 | raise error.Abort(_('at least one of -n/-c is required for -l')) | |
|
337 | 337 | |
|
338 | 338 | if fm: |
|
339 | 339 | def makefunc(get, fmt): |
@@ -348,7 +348,7 def annotate(ui, repo, *pats, **opts): | |||
|
348 | 348 | if opts.get(op)) |
|
349 | 349 | |
|
350 | 350 | def bad(x, y): |
|
351 |
raise |
|
|
351 | raise error.Abort("%s: %s" % (x, y)) | |
|
352 | 352 | |
|
353 | 353 | m = scmutil.match(ctx, pats, opts, badfn=bad) |
|
354 | 354 | |
@@ -438,18 +438,18 def archive(ui, repo, dest, **opts): | |||
|
438 | 438 | |
|
439 | 439 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
440 | 440 | if not ctx: |
|
441 |
raise |
|
|
441 | raise error.Abort(_('no working directory: please specify a revision')) | |
|
442 | 442 | node = ctx.node() |
|
443 | 443 | dest = cmdutil.makefilename(repo, dest, node) |
|
444 | 444 | if os.path.realpath(dest) == repo.root: |
|
445 |
raise |
|
|
445 | raise error.Abort(_('repository root cannot be destination')) | |
|
446 | 446 | |
|
447 | 447 | kind = opts.get('type') or archival.guesskind(dest) or 'files' |
|
448 | 448 | prefix = opts.get('prefix') |
|
449 | 449 | |
|
450 | 450 | if dest == '-': |
|
451 | 451 | if kind == 'files': |
|
452 |
raise |
|
|
452 | raise error.Abort(_('cannot archive plain files to stdout')) | |
|
453 | 453 | dest = cmdutil.makefileobj(repo, dest) |
|
454 | 454 | if not prefix: |
|
455 | 455 | prefix = os.path.basename(repo.root) + '-%h' |
@@ -504,13 +504,13 def backout(ui, repo, node=None, rev=Non | |||
|
504 | 504 | files. |
|
505 | 505 | ''' |
|
506 | 506 | if rev and node: |
|
507 |
raise |
|
|
507 | raise error.Abort(_("please specify just one revision")) | |
|
508 | 508 | |
|
509 | 509 | if not rev: |
|
510 | 510 | rev = node |
|
511 | 511 | |
|
512 | 512 | if not rev: |
|
513 |
raise |
|
|
513 | raise error.Abort(_("please specify a revision to backout")) | |
|
514 | 514 | |
|
515 | 515 | date = opts.get('date') |
|
516 | 516 | if date: |
@@ -522,22 +522,22 def backout(ui, repo, node=None, rev=Non | |||
|
522 | 522 | |
|
523 | 523 | op1, op2 = repo.dirstate.parents() |
|
524 | 524 | if not repo.changelog.isancestor(node, op1): |
|
525 |
raise |
|
|
525 | raise error.Abort(_('cannot backout change that is not an ancestor')) | |
|
526 | 526 | |
|
527 | 527 | p1, p2 = repo.changelog.parents(node) |
|
528 | 528 | if p1 == nullid: |
|
529 |
raise |
|
|
529 | raise error.Abort(_('cannot backout a change with no parents')) | |
|
530 | 530 | if p2 != nullid: |
|
531 | 531 | if not opts.get('parent'): |
|
532 |
raise |
|
|
532 | raise error.Abort(_('cannot backout a merge changeset')) | |
|
533 | 533 | p = repo.lookup(opts['parent']) |
|
534 | 534 | if p not in (p1, p2): |
|
535 |
raise |
|
|
535 | raise error.Abort(_('%s is not a parent of %s') % | |
|
536 | 536 | (short(p), short(node))) |
|
537 | 537 | parent = p |
|
538 | 538 | else: |
|
539 | 539 | if opts.get('parent'): |
|
540 |
raise |
|
|
540 | raise error.Abort(_('cannot use --parent on non-merge changeset')) | |
|
541 | 541 | parent = p1 |
|
542 | 542 | |
|
543 | 543 | # the backout should appear on the same branch |
@@ -746,9 +746,9 def bisect(ui, repo, rev=None, extra=Non | |||
|
746 | 746 | if (good or bad or skip or reset) and interactive: |
|
747 | 747 | return |
|
748 | 748 | if not state['good']: |
|
749 |
raise |
|
|
749 | raise error.Abort(_('cannot bisect (no known good revisions)')) | |
|
750 | 750 | else: |
|
751 |
raise |
|
|
751 | raise error.Abort(_('cannot bisect (no known bad revisions)')) | |
|
752 | 752 | return True |
|
753 | 753 | |
|
754 | 754 | # backward compatibility |
@@ -762,7 +762,7 def bisect(ui, repo, rev=None, extra=Non | |||
|
762 | 762 | else: |
|
763 | 763 | reset = True |
|
764 | 764 | elif extra or good + bad + skip + reset + extend + bool(command) > 1: |
|
765 |
raise |
|
|
765 | raise error.Abort(_('incompatible arguments')) | |
|
766 | 766 | |
|
767 | 767 | cmdutil.checkunfinished(repo) |
|
768 | 768 | |
@@ -780,12 +780,12 def bisect(ui, repo, rev=None, extra=Non | |||
|
780 | 780 | try: |
|
781 | 781 | node = state['current'][0] |
|
782 | 782 | except LookupError: |
|
783 |
raise |
|
|
783 | raise error.Abort(_('current bisect revision is unknown - ' | |
|
784 | 784 | 'start a new bisect to fix')) |
|
785 | 785 | else: |
|
786 | 786 | node, p2 = repo.dirstate.parents() |
|
787 | 787 | if p2 != nullid: |
|
788 |
raise |
|
|
788 | raise error.Abort(_('current bisect revision is a merge')) | |
|
789 | 789 | try: |
|
790 | 790 | while changesets: |
|
791 | 791 | # update state |
@@ -798,9 +798,9 def bisect(ui, repo, rev=None, extra=Non | |||
|
798 | 798 | transition = "good" |
|
799 | 799 | # status < 0 means process was killed |
|
800 | 800 | elif status == 127: |
|
801 |
raise |
|
|
801 | raise error.Abort(_("failed to execute %s") % command) | |
|
802 | 802 | elif status < 0: |
|
803 |
raise |
|
|
803 | raise error.Abort(_("%s killed") % command) | |
|
804 | 804 | else: |
|
805 | 805 | transition = "bad" |
|
806 | 806 | ctx = scmutil.revsingle(repo, rev, node) |
@@ -854,7 +854,7 def bisect(ui, repo, rev=None, extra=Non | |||
|
854 | 854 | return |
|
855 | 855 | cmdutil.bailifchanged(repo) |
|
856 | 856 | return hg.clean(repo, extendnode.node()) |
|
857 |
raise |
|
|
857 | raise error.Abort(_("nothing to extend")) | |
|
858 | 858 | |
|
859 | 859 | if changesets == 0: |
|
860 | 860 | print_result(nodes, good) |
@@ -937,7 +937,7 def bookmark(ui, repo, *names, **opts): | |||
|
937 | 937 | def checkformat(mark): |
|
938 | 938 | mark = mark.strip() |
|
939 | 939 | if not mark: |
|
940 |
raise |
|
|
940 | raise error.Abort(_("bookmark names cannot consist entirely of " | |
|
941 | 941 | "whitespace")) |
|
942 | 942 | scmutil.checknewlabel(repo, mark, 'bookmark') |
|
943 | 943 | return mark |
@@ -967,21 +967,21 def bookmark(ui, repo, *names, **opts): | |||
|
967 | 967 | ui.status(_("moving bookmark '%s' forward from %s\n") % |
|
968 | 968 | (mark, short(bmctx.node()))) |
|
969 | 969 | return |
|
970 |
raise |
|
|
970 | raise error.Abort(_("bookmark '%s' already exists " | |
|
971 | 971 | "(use -f to force)") % mark) |
|
972 | 972 | if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) |
|
973 | 973 | and not force): |
|
974 |
raise |
|
|
974 | raise error.Abort( | |
|
975 | 975 | _("a bookmark cannot have the name of an existing branch")) |
|
976 | 976 | |
|
977 | 977 | if delete and rename: |
|
978 |
raise |
|
|
978 | raise error.Abort(_("--delete and --rename are incompatible")) | |
|
979 | 979 | if delete and rev: |
|
980 |
raise |
|
|
980 | raise error.Abort(_("--rev is incompatible with --delete")) | |
|
981 | 981 | if rename and rev: |
|
982 |
raise |
|
|
982 | raise error.Abort(_("--rev is incompatible with --rename")) | |
|
983 | 983 | if not names and (delete or rev): |
|
984 |
raise |
|
|
984 | raise error.Abort(_("bookmark name required")) | |
|
985 | 985 | |
|
986 | 986 | if delete or rename or names or inactive: |
|
987 | 987 | wlock = lock = tr = None |
@@ -994,7 +994,7 def bookmark(ui, repo, *names, **opts): | |||
|
994 | 994 | tr = repo.transaction('bookmark') |
|
995 | 995 | for mark in names: |
|
996 | 996 | if mark not in marks: |
|
997 |
raise |
|
|
997 | raise error.Abort(_("bookmark '%s' does not exist") % | |
|
998 | 998 | mark) |
|
999 | 999 | if mark == repo._activebookmark: |
|
1000 | 1000 | bookmarks.deactivate(repo) |
@@ -1003,12 +1003,13 def bookmark(ui, repo, *names, **opts): | |||
|
1003 | 1003 | elif rename: |
|
1004 | 1004 | tr = repo.transaction('bookmark') |
|
1005 | 1005 | if not names: |
|
1006 |
raise |
|
|
1006 | raise error.Abort(_("new bookmark name required")) | |
|
1007 | 1007 | elif len(names) > 1: |
|
1008 |
raise |
|
|
1008 | raise error.Abort(_("only one new bookmark name allowed")) | |
|
1009 | 1009 | mark = checkformat(names[0]) |
|
1010 | 1010 | if rename not in marks: |
|
1011 |
raise |
|
|
1011 | raise error.Abort(_("bookmark '%s' does not exist") | |
|
1012 | % rename) | |
|
1012 | 1013 | checkconflict(repo, mark, cur, force) |
|
1013 | 1014 | marks[mark] = marks[rename] |
|
1014 | 1015 | if repo._activebookmark == rename and not inactive: |
@@ -1119,7 +1120,7 def branch(ui, repo, label=None, **opts) | |||
|
1119 | 1120 | elif label: |
|
1120 | 1121 | if not opts.get('force') and label in repo.branchmap(): |
|
1121 | 1122 | if label not in [p.branch() for p in repo.parents()]: |
|
1122 |
raise |
|
|
1123 | raise error.Abort(_('a branch of the same name already' | |
|
1123 | 1124 | ' exists'), |
|
1124 | 1125 | # i18n: "it" refers to an existing branch |
|
1125 | 1126 | hint=_("use 'hg update' to switch to it")) |
@@ -1251,7 +1252,7 def bundle(ui, repo, fname, dest=None, * | |||
|
1251 | 1252 | bundlecaps = None |
|
1252 | 1253 | if base: |
|
1253 | 1254 | if dest: |
|
1254 |
raise |
|
|
1255 | raise error.Abort(_("--base is incompatible with specifying " | |
|
1255 | 1256 | "a destination")) |
|
1256 | 1257 | common = [repo.lookup(rev) for rev in base] |
|
1257 | 1258 | heads = revs and map(repo.lookup, revs) or revs |
@@ -1429,7 +1430,7 def clone(ui, source, dest=None, **opts) | |||
|
1429 | 1430 | Returns 0 on success. |
|
1430 | 1431 | """ |
|
1431 | 1432 | if opts.get('noupdate') and opts.get('updaterev'): |
|
1432 |
raise |
|
|
1433 | raise error.Abort(_("cannot specify both --noupdate and --updaterev")) | |
|
1433 | 1434 | |
|
1434 | 1435 | r = hg.clone(ui, opts, source, dest, |
|
1435 | 1436 | pull=opts.get('pull'), |
@@ -1501,7 +1502,7 def commit(ui, repo, *pats, **opts): | |||
|
1501 | 1502 | |
|
1502 | 1503 | if opts.get('subrepos'): |
|
1503 | 1504 | if opts.get('amend'): |
|
1504 |
raise |
|
|
1505 | raise error.Abort(_('cannot amend with --subrepos')) | |
|
1505 | 1506 | # Let --subrepos on the command line override config setting. |
|
1506 | 1507 | ui.setconfig('ui', 'commitsubrepos', True, 'commit') |
|
1507 | 1508 | |
@@ -1515,24 +1516,24 def commit(ui, repo, *pats, **opts): | |||
|
1515 | 1516 | extra['close'] = 1 |
|
1516 | 1517 | |
|
1517 | 1518 | if not bheads: |
|
1518 |
raise |
|
|
1519 | raise error.Abort(_('can only close branch heads')) | |
|
1519 | 1520 | elif opts.get('amend'): |
|
1520 | 1521 | if repo.parents()[0].p1().branch() != branch and \ |
|
1521 | 1522 | repo.parents()[0].p2().branch() != branch: |
|
1522 |
raise |
|
|
1523 | raise error.Abort(_('can only close branch heads')) | |
|
1523 | 1524 | |
|
1524 | 1525 | if opts.get('amend'): |
|
1525 | 1526 | if ui.configbool('ui', 'commitsubrepos'): |
|
1526 |
raise |
|
|
1527 | raise error.Abort(_('cannot amend with ui.commitsubrepos enabled')) | |
|
1527 | 1528 | |
|
1528 | 1529 | old = repo['.'] |
|
1529 | 1530 | if not old.mutable(): |
|
1530 |
raise |
|
|
1531 | raise error.Abort(_('cannot amend public changesets')) | |
|
1531 | 1532 | if len(repo[None].parents()) > 1: |
|
1532 |
raise |
|
|
1533 | raise error.Abort(_('cannot amend while merging')) | |
|
1533 | 1534 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) |
|
1534 | 1535 | if not allowunstable and old.children(): |
|
1535 |
raise |
|
|
1536 | raise error.Abort(_('cannot amend changeset with children')) | |
|
1536 | 1537 | |
|
1537 | 1538 | # commitfunc is used only for temporary amend commit by cmdutil.amend |
|
1538 | 1539 | def commitfunc(ui, repo, message, match, opts): |
@@ -1614,11 +1615,11 def config(ui, repo, *values, **opts): | |||
|
1614 | 1615 | |
|
1615 | 1616 | if opts.get('edit') or opts.get('local') or opts.get('global'): |
|
1616 | 1617 | if opts.get('local') and opts.get('global'): |
|
1617 |
raise |
|
|
1618 | raise error.Abort(_("can't use --local and --global together")) | |
|
1618 | 1619 | |
|
1619 | 1620 | if opts.get('local'): |
|
1620 | 1621 | if not repo: |
|
1621 |
raise |
|
|
1622 | raise error.Abort(_("can't use --local outside a repository")) | |
|
1622 | 1623 | paths = [repo.join('hgrc')] |
|
1623 | 1624 | elif opts.get('global'): |
|
1624 | 1625 | paths = scmutil.systemrcpath() |
@@ -1643,7 +1644,7 def config(ui, repo, *values, **opts): | |||
|
1643 | 1644 | |
|
1644 | 1645 | editor = ui.geteditor() |
|
1645 | 1646 | ui.system("%s \"%s\"" % (editor, f), |
|
1646 |
onerr= |
|
|
1647 | onerr=error.Abort, errprefix=_("edit failed")) | |
|
1647 | 1648 | return |
|
1648 | 1649 | |
|
1649 | 1650 | for f in scmutil.rcpath(): |
@@ -1653,7 +1654,7 def config(ui, repo, *values, **opts): | |||
|
1653 | 1654 | sections = [v for v in values if '.' not in v] |
|
1654 | 1655 | items = [v for v in values if '.' in v] |
|
1655 | 1656 | if len(items) > 1 or items and sections: |
|
1656 |
raise |
|
|
1657 | raise error.Abort(_('only one config item permitted')) | |
|
1657 | 1658 | matched = False |
|
1658 | 1659 | for section, name, value in ui.walkconfig(untrusted=untrusted): |
|
1659 | 1660 | value = str(value).replace('\n', '\\n') |
@@ -1715,13 +1716,13 def debugancestor(ui, repo, *args): | |||
|
1715 | 1716 | lookup = r.lookup |
|
1716 | 1717 | elif len(args) == 2: |
|
1717 | 1718 | if not repo: |
|
1718 |
raise |
|
|
1719 | raise error.Abort(_("there is no Mercurial repository here " | |
|
1719 | 1720 | "(.hg not found)")) |
|
1720 | 1721 | rev1, rev2 = args |
|
1721 | 1722 | r = repo.changelog |
|
1722 | 1723 | lookup = repo.lookup |
|
1723 | 1724 | else: |
|
1724 |
raise |
|
|
1725 | raise error.Abort(_('either two or three arguments required')) | |
|
1725 | 1726 | a = r.ancestor(lookup(rev1), lookup(rev2)) |
|
1726 | 1727 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
|
1727 | 1728 | |
@@ -1772,7 +1773,7 def debugbuilddag(ui, repo, text=None, | |||
|
1772 | 1773 | |
|
1773 | 1774 | cl = repo.changelog |
|
1774 | 1775 | if len(cl) > 0: |
|
1775 |
raise |
|
|
1776 | raise error.Abort(_('repository is not empty')) | |
|
1776 | 1777 | |
|
1777 | 1778 | # determine number of revs in DAG |
|
1778 | 1779 | total = 0 |
@@ -1920,7 +1921,7 def debugbundle(ui, bundlepath, all=None | |||
|
1920 | 1921 | showchunks(fname) |
|
1921 | 1922 | else: |
|
1922 | 1923 | if isinstance(gen, bundle2.unbundle20): |
|
1923 |
raise |
|
|
1924 | raise error.Abort(_('use debugbundle2 for this file')) | |
|
1924 | 1925 | chunkdata = gen.changelogheader() |
|
1925 | 1926 | chain = None |
|
1926 | 1927 | while True: |
@@ -1936,7 +1937,7 def debugbundle(ui, bundlepath, all=None | |||
|
1936 | 1937 | def _debugbundle2(ui, gen, **opts): |
|
1937 | 1938 | """lists the contents of a bundle2""" |
|
1938 | 1939 | if not isinstance(gen, bundle2.unbundle20): |
|
1939 |
raise |
|
|
1940 | raise error.Abort(_('not a bundle2 file')) | |
|
1940 | 1941 | ui.write(('Stream params: %s\n' % repr(gen.params))) |
|
1941 | 1942 | for part in gen.iterparts(): |
|
1942 | 1943 | ui.write('%s -- %r\n' % (part.type, repr(part.params))) |
@@ -1979,7 +1980,7 def debugcheckstate(ui, repo): | |||
|
1979 | 1980 | errors += 1 |
|
1980 | 1981 | if errors: |
|
1981 | 1982 | error = _(".hg/dirstate inconsistent with current parent's manifest") |
|
1982 |
raise |
|
|
1983 | raise error.Abort(error) | |
|
1983 | 1984 | |
|
1984 | 1985 | @command('debugcommands', [], _('[COMMAND]'), norepo=True) |
|
1985 | 1986 | def debugcommands(ui, cmd='', *args): |
@@ -2067,7 +2068,7 def debugdag(ui, repo, file_=None, *revs | |||
|
2067 | 2068 | for l in ls: |
|
2068 | 2069 | yield 'l', (r, l) |
|
2069 | 2070 | else: |
|
2070 |
raise |
|
|
2071 | raise error.Abort(_('need repo for changelog dag')) | |
|
2071 | 2072 | |
|
2072 | 2073 | for line in dagparser.dagtextlines(events(), |
|
2073 | 2074 | addspaces=spaces, |
@@ -2094,7 +2095,7 def debugdata(ui, repo, file_, rev=None, | |||
|
2094 | 2095 | try: |
|
2095 | 2096 | ui.write(r.revision(r.lookup(rev))) |
|
2096 | 2097 | except KeyError: |
|
2097 |
raise |
|
|
2098 | raise error.Abort(_('invalid revision identifier %s') % rev) | |
|
2098 | 2099 | |
|
2099 | 2100 | @command('debugdate', |
|
2100 | 2101 | [('e', 'extended', None, _('try extended date formats'))], |
@@ -2131,7 +2132,7 def debugdiscovery(ui, repo, remoteurl=" | |||
|
2131 | 2132 | def doit(localheads, remoteheads, remote=remote): |
|
2132 | 2133 | if opts.get('old'): |
|
2133 | 2134 | if localheads: |
|
2134 |
raise |
|
|
2135 | raise error.Abort('cannot use localheads with old style ' | |
|
2135 | 2136 | 'discovery') |
|
2136 | 2137 | if not util.safehasattr(remote, 'branches'): |
|
2137 | 2138 | # enable in-client legacy support |
@@ -2259,7 +2260,7 def debuggetbundle(ui, repopath, bundlep | |||
|
2259 | 2260 | """ |
|
2260 | 2261 | repo = hg.peer(ui, opts, repopath) |
|
2261 | 2262 | if not repo.capable('getbundle'): |
|
2262 |
raise |
|
|
2263 | raise error.Abort("getbundle() not supported by target repository") | |
|
2263 | 2264 | args = {} |
|
2264 | 2265 | if common: |
|
2265 | 2266 | args['common'] = [bin(s) for s in common] |
@@ -2276,7 +2277,7 def debuggetbundle(ui, repopath, bundlep | |||
|
2276 | 2277 | 'bundle2': 'HG20'} |
|
2277 | 2278 | bundletype = btypes.get(bundletype) |
|
2278 | 2279 | if bundletype not in changegroup.bundletypes: |
|
2279 |
raise |
|
|
2280 | raise error.Abort(_('unknown bundle type specified with --type')) | |
|
2280 | 2281 | changegroup.writebundle(ui, bundle, bundlepath, bundletype) |
|
2281 | 2282 | |
|
2282 | 2283 | @command('debugignore', [], '') |
@@ -2287,7 +2288,7 def debugignore(ui, repo, *values, **opt | |||
|
2287 | 2288 | if includepat is not None: |
|
2288 | 2289 | ui.write("%s\n" % includepat) |
|
2289 | 2290 | else: |
|
2290 |
raise |
|
|
2291 | raise error.Abort(_("no ignore patterns found")) | |
|
2291 | 2292 | |
|
2292 | 2293 | @command('debugindex', |
|
2293 | 2294 | [('c', 'changelog', False, _('open changelog')), |
@@ -2301,7 +2302,7 def debugindex(ui, repo, file_=None, **o | |||
|
2301 | 2302 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) |
|
2302 | 2303 | format = opts.get('format', 0) |
|
2303 | 2304 | if format not in (0, 1): |
|
2304 |
raise |
|
|
2305 | raise error.Abort(_("unknown format %d") % format) | |
|
2305 | 2306 | |
|
2306 | 2307 | generaldelta = r.version & revlog.REVLOGGENERALDELTA |
|
2307 | 2308 | if generaldelta: |
@@ -2387,7 +2388,7 def debuginstall(ui): | |||
|
2387 | 2388 | ui.status(_("checking encoding (%s)...\n") % encoding.encoding) |
|
2388 | 2389 | try: |
|
2389 | 2390 | encoding.fromlocal("test") |
|
2390 |
except |
|
|
2391 | except error.Abort as inst: | |
|
2391 | 2392 | ui.write(" %s\n" % inst) |
|
2392 | 2393 | ui.write(_(" (check that your locale is properly set)\n")) |
|
2393 | 2394 | problems += 1 |
@@ -2453,7 +2454,7 def debuginstall(ui): | |||
|
2453 | 2454 | ui.status(_("checking username...\n")) |
|
2454 | 2455 | try: |
|
2455 | 2456 | ui.username() |
|
2456 |
except |
|
|
2457 | except error.Abort as e: | |
|
2457 | 2458 | ui.write(" %s\n" % e) |
|
2458 | 2459 | ui.write(_(" (specify a username in your configuration file)\n")) |
|
2459 | 2460 | problems += 1 |
@@ -2475,7 +2476,7 def debugknown(ui, repopath, *ids, **opt | |||
|
2475 | 2476 | """ |
|
2476 | 2477 | repo = hg.peer(ui, opts, repopath) |
|
2477 | 2478 | if not repo.capable('known'): |
|
2478 |
raise |
|
|
2479 | raise error.Abort("known() not supported by target repository") | |
|
2479 | 2480 | flags = repo.known([bin(s) for s in ids]) |
|
2480 | 2481 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) |
|
2481 | 2482 | |
@@ -2663,12 +2664,12 def debugobsolete(ui, repo, precursor=No | |||
|
2663 | 2664 | raise TypeError() |
|
2664 | 2665 | return n |
|
2665 | 2666 | except TypeError: |
|
2666 |
raise |
|
|
2667 | raise error.Abort('changeset references must be full hexadecimal ' | |
|
2667 | 2668 | 'node identifiers') |
|
2668 | 2669 | |
|
2669 | 2670 | if precursor is not None: |
|
2670 | 2671 | if opts['rev']: |
|
2671 |
raise |
|
|
2672 | raise error.Abort('cannot select revision when creating marker') | |
|
2672 | 2673 | metadata = {} |
|
2673 | 2674 | metadata['user'] = opts['user'] or ui.username() |
|
2674 | 2675 | succs = tuple(parsenodeid(succ) for succ in successors) |
@@ -2685,7 +2686,7 def debugobsolete(ui, repo, precursor=No | |||
|
2685 | 2686 | parents = None |
|
2686 | 2687 | if opts['record_parents']: |
|
2687 | 2688 | if prec not in repo.unfiltered(): |
|
2688 |
raise |
|
|
2689 | raise error.Abort('cannot used --record-parents on ' | |
|
2689 | 2690 | 'unknown changesets') |
|
2690 | 2691 | parents = repo.unfiltered()[prec].parents() |
|
2691 | 2692 | parents = tuple(p.node() for p in parents) |
@@ -2694,7 +2695,7 def debugobsolete(ui, repo, precursor=No | |||
|
2694 | 2695 | metadata=metadata) |
|
2695 | 2696 | tr.close() |
|
2696 | 2697 | except ValueError as exc: |
|
2697 |
raise |
|
|
2698 | raise error.Abort(_('bad obsmarker input: %s') % exc) | |
|
2698 | 2699 | finally: |
|
2699 | 2700 | tr.release() |
|
2700 | 2701 | finally: |
@@ -3319,7 +3320,7 def diff(ui, repo, *pats, **opts): | |||
|
3319 | 3320 | |
|
3320 | 3321 | if revs and change: |
|
3321 | 3322 | msg = _('cannot specify --rev and --change at the same time') |
|
3322 |
raise |
|
|
3323 | raise error.Abort(msg) | |
|
3323 | 3324 | elif change: |
|
3324 | 3325 | node2 = scmutil.revsingle(repo, change, None).node() |
|
3325 | 3326 | node1 = repo[node2].p1().node() |
@@ -3407,7 +3408,7 def export(ui, repo, *changesets, **opts | |||
|
3407 | 3408 | changesets = ['.'] |
|
3408 | 3409 | revs = scmutil.revrange(repo, changesets) |
|
3409 | 3410 | if not revs: |
|
3410 |
raise |
|
|
3411 | raise error.Abort(_("export requires at least one changeset")) | |
|
3411 | 3412 | if len(revs) > 1: |
|
3412 | 3413 | ui.note(_('exporting patches:\n')) |
|
3413 | 3414 | else: |
@@ -3511,7 +3512,7 def forget(ui, repo, *pats, **opts): | |||
|
3511 | 3512 | """ |
|
3512 | 3513 | |
|
3513 | 3514 | if not pats: |
|
3514 |
raise |
|
|
3515 | raise error.Abort(_('no files specified')) | |
|
3515 | 3516 | |
|
3516 | 3517 | m = scmutil.match(repo[None], pats, opts) |
|
3517 | 3518 | rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0] |
@@ -3602,7 +3603,7 def graft(ui, repo, *revs, **opts): | |||
|
3602 | 3603 | if opts['continue']: |
|
3603 | 3604 | cont = True |
|
3604 | 3605 | if revs: |
|
3605 |
raise |
|
|
3606 | raise error.Abort(_("can't specify --continue and revisions")) | |
|
3606 | 3607 | # read in unfinished revisions |
|
3607 | 3608 | try: |
|
3608 | 3609 | nodes = repo.vfs.read('graftstate').splitlines() |
@@ -3610,12 +3611,12 def graft(ui, repo, *revs, **opts): | |||
|
3610 | 3611 | except IOError as inst: |
|
3611 | 3612 | if inst.errno != errno.ENOENT: |
|
3612 | 3613 | raise |
|
3613 |
raise |
|
|
3614 | raise error.Abort(_("no graft state found, can't continue")) | |
|
3614 | 3615 | else: |
|
3615 | 3616 | cmdutil.checkunfinished(repo) |
|
3616 | 3617 | cmdutil.bailifchanged(repo) |
|
3617 | 3618 | if not revs: |
|
3618 |
raise |
|
|
3619 | raise error.Abort(_('no revisions specified')) | |
|
3619 | 3620 | revs = scmutil.revrange(repo, revs) |
|
3620 | 3621 | |
|
3621 | 3622 | skipped = set() |
@@ -3738,7 +3739,7 def graft(ui, repo, *revs, **opts): | |||
|
3738 | 3739 | # write out state for --continue |
|
3739 | 3740 | nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] |
|
3740 | 3741 | repo.vfs.write('graftstate', ''.join(nodelines)) |
|
3741 |
raise |
|
|
3742 | raise error.Abort( | |
|
3742 | 3743 | _("unresolved conflicts, can't continue"), |
|
3743 | 3744 | hint=_('use hg resolve and hg graft --continue')) |
|
3744 | 3745 | else: |
@@ -4101,7 +4102,7 def help_(ui, name=None, **opts): | |||
|
4101 | 4102 | # to look for, or we could have simply failed to found "foo.bar" |
|
4102 | 4103 | # because bar isn't a section of foo |
|
4103 | 4104 | if section and not (formatted and name): |
|
4104 |
raise |
|
|
4105 | raise error.Abort(_("help section not found")) | |
|
4105 | 4106 | |
|
4106 | 4107 | if 'verbose' in pruned: |
|
4107 | 4108 | keep.append('omitted') |
@@ -4158,7 +4159,7 def identify(ui, repo, source=None, rev= | |||
|
4158 | 4159 | """ |
|
4159 | 4160 | |
|
4160 | 4161 | if not repo and not source: |
|
4161 |
raise |
|
|
4162 | raise error.Abort(_("there is no Mercurial repository here " | |
|
4162 | 4163 | "(.hg not found)")) |
|
4163 | 4164 | |
|
4164 | 4165 | if ui.debugflag: |
@@ -4177,7 +4178,7 def identify(ui, repo, source=None, rev= | |||
|
4177 | 4178 | |
|
4178 | 4179 | if not repo: |
|
4179 | 4180 | if num or branch or tags: |
|
4180 |
raise |
|
|
4181 | raise error.Abort( | |
|
4181 | 4182 | _("can't query remote revision number, branch, or tags")) |
|
4182 | 4183 | if not rev and revs: |
|
4183 | 4184 | rev = revs[0] |
@@ -4370,7 +4371,7 def import_(ui, repo, patch1=None, *patc | |||
|
4370 | 4371 | """ |
|
4371 | 4372 | |
|
4372 | 4373 | if not patch1: |
|
4373 |
raise |
|
|
4374 | raise error.Abort(_('need at least one patch to import')) | |
|
4374 | 4375 | |
|
4375 | 4376 | patches = (patch1,) + patches |
|
4376 | 4377 | |
@@ -4380,19 +4381,19 def import_(ui, repo, patch1=None, *patc | |||
|
4380 | 4381 | |
|
4381 | 4382 | update = not opts.get('bypass') |
|
4382 | 4383 | if not update and opts.get('no_commit'): |
|
4383 |
raise |
|
|
4384 | raise error.Abort(_('cannot use --no-commit with --bypass')) | |
|
4384 | 4385 | try: |
|
4385 | 4386 | sim = float(opts.get('similarity') or 0) |
|
4386 | 4387 | except ValueError: |
|
4387 |
raise |
|
|
4388 | raise error.Abort(_('similarity must be a number')) | |
|
4388 | 4389 | if sim < 0 or sim > 100: |
|
4389 |
raise |
|
|
4390 | raise error.Abort(_('similarity must be between 0 and 100')) | |
|
4390 | 4391 | if sim and not update: |
|
4391 |
raise |
|
|
4392 | raise error.Abort(_('cannot use --similarity with --bypass')) | |
|
4392 | 4393 | if opts.get('exact') and opts.get('edit'): |
|
4393 |
raise |
|
|
4394 | raise error.Abort(_('cannot use --exact with --edit')) | |
|
4394 | 4395 | if opts.get('exact') and opts.get('prefix'): |
|
4395 |
raise |
|
|
4396 | raise error.Abort(_('cannot use --exact with --prefix')) | |
|
4396 | 4397 | |
|
4397 | 4398 | if update: |
|
4398 | 4399 | cmdutil.checkunfinished(repo) |
@@ -4444,7 +4445,7 def import_(ui, repo, patch1=None, *patc | |||
|
4444 | 4445 | break |
|
4445 | 4446 | |
|
4446 | 4447 | if not haspatch: |
|
4447 |
raise |
|
|
4448 | raise error.Abort(_('%s: no diffs found') % patchurl) | |
|
4448 | 4449 | |
|
4449 | 4450 | if tr: |
|
4450 | 4451 | tr.close() |
@@ -4540,7 +4541,7 def incoming(ui, repo, source="default", | |||
|
4540 | 4541 | return 0 |
|
4541 | 4542 | |
|
4542 | 4543 | if opts.get('bundle') and opts.get('subrepos'): |
|
4543 |
raise |
|
|
4544 | raise error.Abort(_('cannot combine --bundle and --subrepos')) | |
|
4544 | 4545 | |
|
4545 | 4546 | if opts.get('bookmarks'): |
|
4546 | 4547 | source, branches = hg.parseurl(ui.expandpath(source), |
@@ -4806,7 +4807,7 def manifest(ui, repo, node=None, rev=No | |||
|
4806 | 4807 | |
|
4807 | 4808 | if opts.get('all'): |
|
4808 | 4809 | if rev or node: |
|
4809 |
raise |
|
|
4810 | raise error.Abort(_("can't specify a revision with --all")) | |
|
4810 | 4811 | |
|
4811 | 4812 | res = [] |
|
4812 | 4813 | prefix = "data/" |
@@ -4827,7 +4828,7 def manifest(ui, repo, node=None, rev=No | |||
|
4827 | 4828 | return |
|
4828 | 4829 | |
|
4829 | 4830 | if rev and node: |
|
4830 |
raise |
|
|
4831 | raise error.Abort(_("please specify just one revision")) | |
|
4831 | 4832 | |
|
4832 | 4833 | if not node: |
|
4833 | 4834 | node = rev |
@@ -4882,7 +4883,7 def merge(ui, repo, node=None, **opts): | |||
|
4882 | 4883 | """ |
|
4883 | 4884 | |
|
4884 | 4885 | if opts.get('rev') and node: |
|
4885 |
raise |
|
|
4886 | raise error.Abort(_("please specify just one revision")) | |
|
4886 | 4887 | if not node: |
|
4887 | 4888 | node = opts.get('rev') |
|
4888 | 4889 | |
@@ -5012,7 +5013,7 def parents(ui, repo, file_=None, **opts | |||
|
5012 | 5013 | if file_: |
|
5013 | 5014 | m = scmutil.match(ctx, (file_,), opts) |
|
5014 | 5015 | if m.anypats() or len(m.files()) != 1: |
|
5015 |
raise |
|
|
5016 | raise error.Abort(_('can only specify an explicit filename')) | |
|
5016 | 5017 | file_ = m.files()[0] |
|
5017 | 5018 | filenodes = [] |
|
5018 | 5019 | for cp in ctx.parents(): |
@@ -5023,7 +5024,7 def parents(ui, repo, file_=None, **opts | |||
|
5023 | 5024 | except error.LookupError: |
|
5024 | 5025 | pass |
|
5025 | 5026 | if not filenodes: |
|
5026 |
raise |
|
|
5027 | raise error.Abort(_("'%s' not found in manifest!") % file_) | |
|
5027 | 5028 | p = [] |
|
5028 | 5029 | for fn in filenodes: |
|
5029 | 5030 | fctx = repo.filectx(file_, fileid=fn) |
@@ -5112,7 +5113,7 def phase(ui, repo, *revs, **opts): | |||
|
5112 | 5113 | for idx, name in enumerate(phases.phasenames): |
|
5113 | 5114 | if opts[name]: |
|
5114 | 5115 | if targetphase is not None: |
|
5115 |
raise |
|
|
5116 | raise error.Abort(_('only one phase can be specified')) | |
|
5116 | 5117 | targetphase = idx |
|
5117 | 5118 | |
|
5118 | 5119 | # look for specified revision |
@@ -5139,7 +5140,7 def phase(ui, repo, *revs, **opts): | |||
|
5139 | 5140 | tr = repo.transaction("phase") |
|
5140 | 5141 | # set phase |
|
5141 | 5142 | if not revs: |
|
5142 |
raise |
|
|
5143 | raise error.Abort(_('empty revision set')) | |
|
5143 | 5144 | nodes = [repo[r].node() for r in revs] |
|
5144 | 5145 | # moving revision from public to draft may hide them |
|
5145 | 5146 | # We have to check result on an unfiltered repository |
@@ -5181,7 +5182,7 def postincoming(ui, repo, modheads, opt | |||
|
5181 | 5182 | checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) |
|
5182 | 5183 | try: |
|
5183 | 5184 | ret = hg.update(repo, checkout) |
|
5184 |
except |
|
|
5185 | except error.Abort as inst: | |
|
5185 | 5186 | ui.warn(_("not updating: %s\n") % str(inst)) |
|
5186 | 5187 | if inst.hint: |
|
5187 | 5188 | ui.warn(_("(%s)\n") % inst.hint) |
@@ -5252,7 +5253,7 def pull(ui, repo, source="default", **o | |||
|
5252 | 5253 | pullopargs['remotebookmarks'] = remotebookmarks |
|
5253 | 5254 | for b in opts['bookmark']: |
|
5254 | 5255 | if b not in remotebookmarks: |
|
5255 |
raise |
|
|
5256 | raise error.Abort(_('remote bookmark %s not found!') % b) | |
|
5256 | 5257 | revs.append(remotebookmarks[b]) |
|
5257 | 5258 | |
|
5258 | 5259 | if revs: |
@@ -5270,7 +5271,7 def pull(ui, repo, source="default", **o | |||
|
5270 | 5271 | except error.CapabilityError: |
|
5271 | 5272 | err = _("other repository doesn't support revision lookup, " |
|
5272 | 5273 | "so a rev cannot be specified.") |
|
5273 |
raise |
|
|
5274 | raise error.Abort(err) | |
|
5274 | 5275 | |
|
5275 | 5276 | modheads = exchange.pull(repo, other, heads=revs, |
|
5276 | 5277 | force=opts.get('force'), |
@@ -5350,7 +5351,7 def push(ui, repo, dest=None, **opts): | |||
|
5350 | 5351 | |
|
5351 | 5352 | path = ui.paths.getpath(dest, default='default') |
|
5352 | 5353 | if not path: |
|
5353 |
raise |
|
|
5354 | raise error.Abort(_('default repository not configured!'), | |
|
5354 | 5355 | hint=_('see the "path" section in "hg help config"')) |
|
5355 | 5356 | dest, branches = path.pushloc, (path.branch, opts.get('branch') or []) |
|
5356 | 5357 | ui.status(_('pushing to %s\n') % util.hidepassword(dest)) |
@@ -5360,7 +5361,7 def push(ui, repo, dest=None, **opts): | |||
|
5360 | 5361 | if revs: |
|
5361 | 5362 | revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] |
|
5362 | 5363 | if not revs: |
|
5363 |
raise |
|
|
5364 | raise error.Abort(_("specified revisions evaluate to an empty set"), | |
|
5364 | 5365 | hint=_("use different revision arguments")) |
|
5365 | 5366 | |
|
5366 | 5367 | repo._subtoppath = dest |
@@ -5450,7 +5451,7 def remove(ui, repo, *pats, **opts): | |||
|
5450 | 5451 | |
|
5451 | 5452 | after, force = opts.get('after'), opts.get('force') |
|
5452 | 5453 | if not pats and not after: |
|
5453 |
raise |
|
|
5454 | raise error.Abort(_('no files specified')) | |
|
5454 | 5455 | |
|
5455 | 5456 | m = scmutil.match(repo[None], pats, opts) |
|
5456 | 5457 | subrepos = opts.get('subrepos') |
@@ -5534,11 +5535,11 def resolve(ui, repo, *pats, **opts): | |||
|
5534 | 5535 | [opts.get(o) for o in 'all mark unmark list no_status'.split()] |
|
5535 | 5536 | |
|
5536 | 5537 | if (show and (mark or unmark)) or (mark and unmark): |
|
5537 |
raise |
|
|
5538 | raise error.Abort(_("too many options specified")) | |
|
5538 | 5539 | if pats and all: |
|
5539 |
raise |
|
|
5540 | raise error.Abort(_("can't specify --all and patterns")) | |
|
5540 | 5541 | if not (all or pats or show or mark or unmark): |
|
5541 |
raise |
|
|
5542 | raise error.Abort(_('no files or directories specified'), | |
|
5542 | 5543 | hint=('use --all to re-merge all unresolved files')) |
|
5543 | 5544 | |
|
5544 | 5545 | if show: |
@@ -5560,7 +5561,7 def resolve(ui, repo, *pats, **opts): | |||
|
5560 | 5561 | ms = mergemod.mergestate(repo) |
|
5561 | 5562 | |
|
5562 | 5563 | if not (ms.active() or repo.dirstate.p2() != nullid): |
|
5563 |
raise |
|
|
5564 | raise error.Abort( | |
|
5564 | 5565 | _('resolve command not applicable when not merging')) |
|
5565 | 5566 | |
|
5566 | 5567 | m = scmutil.match(repo[None], pats, opts) |
@@ -5656,13 +5657,13 def revert(ui, repo, *pats, **opts): | |||
|
5656 | 5657 | |
|
5657 | 5658 | if opts.get("date"): |
|
5658 | 5659 | if opts.get("rev"): |
|
5659 |
raise |
|
|
5660 | raise error.Abort(_("you can't specify a revision and a date")) | |
|
5660 | 5661 | opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) |
|
5661 | 5662 | |
|
5662 | 5663 | parent, p2 = repo.dirstate.parents() |
|
5663 | 5664 | if not opts.get('rev') and p2 != nullid: |
|
5664 | 5665 | # revert after merge is a trap for new users (issue2915) |
|
5665 |
raise |
|
|
5666 | raise error.Abort(_('uncommitted merge with no revision specified'), | |
|
5666 | 5667 | hint=_('use "hg update" or see "hg help revert"')) |
|
5667 | 5668 | |
|
5668 | 5669 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
@@ -5673,7 +5674,7 def revert(ui, repo, *pats, **opts): | |||
|
5673 | 5674 | if p2 != nullid: |
|
5674 | 5675 | hint = _("uncommitted merge, use --all to discard all changes," |
|
5675 | 5676 | " or 'hg update -C .' to abort the merge") |
|
5676 |
raise |
|
|
5677 | raise error.Abort(msg, hint=hint) | |
|
5677 | 5678 | dirty = any(repo.status()) |
|
5678 | 5679 | node = ctx.node() |
|
5679 | 5680 | if node != parent: |
@@ -5687,7 +5688,7 def revert(ui, repo, *pats, **opts): | |||
|
5687 | 5688 | hint = _("uncommitted changes, use --all to discard all changes") |
|
5688 | 5689 | else: |
|
5689 | 5690 | hint = _("use --all to revert all files") |
|
5690 |
raise |
|
|
5691 | raise error.Abort(msg, hint=hint) | |
|
5691 | 5692 | |
|
5692 | 5693 | return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) |
|
5693 | 5694 | |
@@ -5799,7 +5800,7 def serve(ui, repo, **opts): | |||
|
5799 | 5800 | """ |
|
5800 | 5801 | |
|
5801 | 5802 | if opts["stdio"] and opts["cmdserver"]: |
|
5802 |
raise |
|
|
5803 | raise error.Abort(_("cannot use --stdio with --cmdserver")) | |
|
5803 | 5804 | |
|
5804 | 5805 | if opts["stdio"]: |
|
5805 | 5806 | if repo is None: |
@@ -5968,7 +5969,7 def status(ui, repo, *pats, **opts): | |||
|
5968 | 5969 | |
|
5969 | 5970 | if revs and change: |
|
5970 | 5971 | msg = _('cannot specify --rev and --change at the same time') |
|
5971 |
raise |
|
|
5972 | raise error.Abort(msg) | |
|
5972 | 5973 | elif change: |
|
5973 | 5974 | node2 = scmutil.revsingle(repo, change, None).node() |
|
5974 | 5975 | node1 = repo[node2].p1().node() |
@@ -6320,14 +6321,14 def tag(ui, repo, name1, *names, **opts) | |||
|
6320 | 6321 | rev_ = "." |
|
6321 | 6322 | names = [t.strip() for t in (name1,) + names] |
|
6322 | 6323 | if len(names) != len(set(names)): |
|
6323 |
raise |
|
|
6324 | raise error.Abort(_('tag names must be unique')) | |
|
6324 | 6325 | for n in names: |
|
6325 | 6326 | scmutil.checknewlabel(repo, n, 'tag') |
|
6326 | 6327 | if not n: |
|
6327 |
raise |
|
|
6328 | raise error.Abort(_('tag names cannot consist entirely of ' | |
|
6328 | 6329 | 'whitespace')) |
|
6329 | 6330 | if opts.get('rev') and opts.get('remove'): |
|
6330 |
raise |
|
|
6331 | raise error.Abort(_("--rev and --remove are incompatible")) | |
|
6331 | 6332 | if opts.get('rev'): |
|
6332 | 6333 | rev_ = opts['rev'] |
|
6333 | 6334 | message = opts.get('message') |
@@ -6339,12 +6340,12 def tag(ui, repo, name1, *names, **opts) | |||
|
6339 | 6340 | |
|
6340 | 6341 | for n in names: |
|
6341 | 6342 | if not repo.tagtype(n): |
|
6342 |
raise |
|
|
6343 | raise error.Abort(_("tag '%s' does not exist") % n) | |
|
6343 | 6344 | if repo.tagtype(n) != expectedtype: |
|
6344 | 6345 | if expectedtype == 'global': |
|
6345 |
raise |
|
|
6346 | raise error.Abort(_("tag '%s' is not a global tag") % n) | |
|
6346 | 6347 | else: |
|
6347 |
raise |
|
|
6348 | raise error.Abort(_("tag '%s' is not a local tag") % n) | |
|
6348 | 6349 | rev_ = 'null' |
|
6349 | 6350 | if not message: |
|
6350 | 6351 | # we don't translate commit messages |
@@ -6352,15 +6353,15 def tag(ui, repo, name1, *names, **opts) | |||
|
6352 | 6353 | elif not opts.get('force'): |
|
6353 | 6354 | for n in names: |
|
6354 | 6355 | if n in repo.tags(): |
|
6355 |
raise |
|
|
6356 | raise error.Abort(_("tag '%s' already exists " | |
|
6356 | 6357 | "(use -f to force)") % n) |
|
6357 | 6358 | if not opts.get('local'): |
|
6358 | 6359 | p1, p2 = repo.dirstate.parents() |
|
6359 | 6360 | if p2 != nullid: |
|
6360 |
raise |
|
|
6361 | raise error.Abort(_('uncommitted merge')) | |
|
6361 | 6362 | bheads = repo.branchheads() |
|
6362 | 6363 | if not opts.get('force') and bheads and p1 not in bheads: |
|
6363 |
raise |
|
|
6364 | raise error.Abort(_('not at a branch head (use -f to force)')) | |
|
6364 | 6365 | r = scmutil.revsingle(repo, rev_).node() |
|
6365 | 6366 | |
|
6366 | 6367 | if not message: |
@@ -6381,7 +6382,7 def tag(ui, repo, name1, *names, **opts) | |||
|
6381 | 6382 | # don't allow tagging the null rev |
|
6382 | 6383 | if (not opts.get('remove') and |
|
6383 | 6384 | scmutil.revsingle(repo, rev_).rev() == nullrev): |
|
6384 |
raise |
|
|
6385 | raise error.Abort(_("cannot tag null revision")) | |
|
6385 | 6386 | |
|
6386 | 6387 | repo.tag(names, r, message, opts.get('local'), opts.get('user'), date, |
|
6387 | 6388 | editor=editor) |
@@ -6470,7 +6471,7 def unbundle(ui, repo, fname1, *fnames, | |||
|
6470 | 6471 | op = bundle2.processbundle(repo, gen, lambda: tr) |
|
6471 | 6472 | tr.close() |
|
6472 | 6473 | except error.BundleUnknownFeatureError as exc: |
|
6473 |
raise |
|
|
6474 | raise error.Abort(_('%s: unknown bundle feature, %s') | |
|
6474 | 6475 | % (fname, exc), |
|
6475 | 6476 | hint=_("see https://mercurial-scm.org/" |
|
6476 | 6477 | "wiki/BundleFeature for more " |
@@ -6549,7 +6550,7 def update(ui, repo, node=None, rev=None | |||
|
6549 | 6550 | Returns 0 on success, 1 if there are unresolved files. |
|
6550 | 6551 | """ |
|
6551 | 6552 | if rev and node: |
|
6552 |
raise |
|
|
6553 | raise error.Abort(_("please specify just one revision")) | |
|
6553 | 6554 | |
|
6554 | 6555 | if rev is None or rev == '': |
|
6555 | 6556 | rev = node |
@@ -6560,7 +6561,7 def update(ui, repo, node=None, rev=None | |||
|
6560 | 6561 | |
|
6561 | 6562 | if date: |
|
6562 | 6563 | if rev is not None: |
|
6563 |
raise |
|
|
6564 | raise error.Abort(_("you can't specify a revision and a date")) | |
|
6564 | 6565 | rev = cmdutil.finddate(ui, repo, date) |
|
6565 | 6566 | |
|
6566 | 6567 | # with no argument, we also move the active bookmark, if any |
@@ -6571,7 +6572,8 def update(ui, repo, node=None, rev=None | |||
|
6571 | 6572 | rev = scmutil.revsingle(repo, rev, rev).rev() |
|
6572 | 6573 | |
|
6573 | 6574 | if check and clean: |
|
6574 |
raise |
|
|
6575 | raise error.Abort(_("cannot specify both -c/--check and -C/--clean") | |
|
6576 | ) | |
|
6575 | 6577 | |
|
6576 | 6578 | if check: |
|
6577 | 6579 | cmdutil.bailifchanged(repo, merge=False) |
@@ -8,7 +8,7 | |||
|
8 | 8 | from i18n import _ |
|
9 | 9 | import struct |
|
10 | 10 | import sys, os, errno, traceback, SocketServer |
|
11 | import dispatch, encoding, util | |
|
11 | import dispatch, encoding, util, error | |
|
12 | 12 | |
|
13 | 13 | logfile = None |
|
14 | 14 | |
@@ -222,7 +222,7 class server(object): | |||
|
222 | 222 | else: |
|
223 | 223 | # clients are expected to check what commands are supported by |
|
224 | 224 | # looking at the servers capabilities |
|
225 |
raise |
|
|
225 | raise error.Abort(_('unknown command %s') % cmd) | |
|
226 | 226 | |
|
227 | 227 | return cmd != '' |
|
228 | 228 | |
@@ -301,7 +301,7 class _requesthandler(SocketServer.Strea | |||
|
301 | 301 | sv.serve() |
|
302 | 302 | # handle exceptions that may be raised by command server. most of |
|
303 | 303 | # known exceptions are caught by dispatch. |
|
304 |
except |
|
|
304 | except error.Abort as inst: | |
|
305 | 305 | ui.warn(_('abort: %s\n') % inst) |
|
306 | 306 | except IOError as inst: |
|
307 | 307 | if inst.errno != errno.EPIPE: |
@@ -323,9 +323,9 class unixservice(object): | |||
|
323 | 323 | self.repo = repo |
|
324 | 324 | self.address = opts['address'] |
|
325 | 325 | if not util.safehasattr(SocketServer, 'UnixStreamServer'): |
|
326 |
raise |
|
|
326 | raise error.Abort(_('unsupported platform')) | |
|
327 | 327 | if not self.address: |
|
328 |
raise |
|
|
328 | raise error.Abort(_('no socket path specified with --address')) | |
|
329 | 329 | |
|
330 | 330 | def init(self): |
|
331 | 331 | class cls(SocketServer.ForkingMixIn, SocketServer.UnixStreamServer): |
@@ -351,4 +351,4 def createservice(ui, repo, opts): | |||
|
351 | 351 | try: |
|
352 | 352 | return _servicemap[mode](ui, repo, opts) |
|
353 | 353 | except KeyError: |
|
354 |
raise |
|
|
354 | raise error.Abort(_('unknown mode %s') % mode) |
@@ -1060,7 +1060,7 class filectx(basefilectx): | |||
|
1060 | 1060 | except error.CensoredNodeError: |
|
1061 | 1061 | if self._repo.ui.config("censor", "policy", "abort") == "ignore": |
|
1062 | 1062 | return "" |
|
1063 |
raise |
|
|
1063 | raise error.Abort(_("censored node: %s") % short(self._filenode), | |
|
1064 | 1064 | hint=_("set censor.policy to ignore errors")) |
|
1065 | 1065 | |
|
1066 | 1066 | def size(self): |
@@ -1120,7 +1120,7 class committablectx(basectx): | |||
|
1120 | 1120 | try: |
|
1121 | 1121 | branch = encoding.fromlocal(self._repo.dirstate.branch()) |
|
1122 | 1122 | except UnicodeDecodeError: |
|
1123 |
raise |
|
|
1123 | raise error.Abort(_('branch name not in UTF-8!')) | |
|
1124 | 1124 | self._extra['branch'] = branch |
|
1125 | 1125 | if self._extra['branch'] == '': |
|
1126 | 1126 | self._extra['branch'] = 'default' |
@@ -22,8 +22,8 import tempfile | |||
|
22 | 22 | from .i18n import _ |
|
23 | 23 | from . import ( |
|
24 | 24 | encoding, |
|
25 | error, | |
|
25 | 26 | patch as patchmod, |
|
26 | util, | |
|
27 | 27 | ) |
|
28 | 28 | |
|
29 | 29 | # This is required for ncurses to display non-ASCII characters in default user |
@@ -47,7 +47,7 try: | |||
|
47 | 47 | curses |
|
48 | 48 | except NameError: |
|
49 | 49 | if os.name != 'nt': # Temporary hack to get running on Windows again |
|
50 |
raise |
|
|
50 | raise error.Abort( | |
|
51 | 51 | _('the python curses/wcurses module is not available/installed')) |
|
52 | 52 | |
|
53 | 53 | _origstdout = sys.__stdout__ # used by gethw() |
@@ -498,7 +498,7 def chunkselector(ui, headerlist): | |||
|
498 | 498 | f = signal.getsignal(signal.SIGTSTP) |
|
499 | 499 | curses.wrapper(chunkselector.main) |
|
500 | 500 | if chunkselector.initerr is not None: |
|
501 |
raise |
|
|
501 | raise error.Abort(chunkselector.initerr) | |
|
502 | 502 | # ncurses does not restore signal handler for SIGTSTP |
|
503 | 503 | signal.signal(signal.SIGTSTP, f) |
|
504 | 504 | |
@@ -1566,7 +1566,7 are you sure you want to review/edit and | |||
|
1566 | 1566 | elif keypressed in ["H", "KEY_SLEFT"]: |
|
1567 | 1567 | self.leftarrowshiftevent() |
|
1568 | 1568 | elif keypressed in ["q"]: |
|
1569 |
raise |
|
|
1569 | raise error.Abort(_('user quit')) | |
|
1570 | 1570 | elif keypressed in ["c"]: |
|
1571 | 1571 | if self.confirmcommit(): |
|
1572 | 1572 | return True |
@@ -11,7 +11,7 import re | |||
|
11 | 11 | import string |
|
12 | 12 | |
|
13 | 13 | from .i18n import _ |
|
14 |
from . import |
|
|
14 | from . import error | |
|
15 | 15 | |
|
16 | 16 | def parsedag(desc): |
|
17 | 17 | '''parses a DAG from a concise textual description; generates events |
@@ -269,7 +269,7 def parsedag(desc): | |||
|
269 | 269 | s += c |
|
270 | 270 | i += 1 |
|
271 | 271 | c = nextch() |
|
272 |
raise |
|
|
272 | raise error.Abort(_('invalid character in dag description: ' | |
|
273 | 273 | '%s...') % s) |
|
274 | 274 | |
|
275 | 275 | def dagtextlines(events, |
@@ -298,13 +298,13 def dagtextlines(events, | |||
|
298 | 298 | |
|
299 | 299 | # sanity check |
|
300 | 300 | if r != wantr: |
|
301 |
raise |
|
|
301 | raise error.Abort(_("expected id %i, got %i") % (wantr, r)) | |
|
302 | 302 | if not ps: |
|
303 | 303 | ps = [-1] |
|
304 | 304 | else: |
|
305 | 305 | for p in ps: |
|
306 | 306 | if p >= r: |
|
307 |
raise |
|
|
307 | raise error.Abort(_("parent id %i is larger than " | |
|
308 | 308 | "current id %i") % (p, r)) |
|
309 | 309 | wantr += 1 |
|
310 | 310 | |
@@ -366,7 +366,7 def dagtextlines(events, | |||
|
366 | 366 | yield '#' + data |
|
367 | 367 | yield '\n' |
|
368 | 368 | else: |
|
369 |
raise |
|
|
369 | raise error.Abort(_("invalid event type in dag: %s") | |
|
370 | 370 | % str((type, data))) |
|
371 | 371 | if run: |
|
372 | 372 | yield '+' + str(run) |
@@ -8,7 +8,6 | |||
|
8 | 8 | from .i18n import _ |
|
9 | 9 | from . import ( |
|
10 | 10 | error, |
|
11 | util, | |
|
12 | 11 | obsolete, |
|
13 | 12 | ) |
|
14 | 13 | |
@@ -26,7 +25,7 def destupdate(repo): | |||
|
26 | 25 | if wc.branch() == 'default': # no default branch! |
|
27 | 26 | node = repo.lookup('tip') # update to tip |
|
28 | 27 | else: |
|
29 |
raise |
|
|
28 | raise error.Abort(_("branch %s not found") % wc.branch()) | |
|
30 | 29 | |
|
31 | 30 | if p1.obsolete() and not p1.children(): |
|
32 | 31 | # allow updating to successors |
@@ -7,7 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | from node import nullid |
|
9 | 9 | from i18n import _ |
|
10 | import scmutil, util, osutil, parsers, encoding, pathutil | |
|
10 | import scmutil, util, osutil, parsers, encoding, pathutil, error | |
|
11 | 11 | import os, stat, errno |
|
12 | 12 | import match as matchmod |
|
13 | 13 | |
@@ -134,7 +134,7 class dirstate(object): | |||
|
134 | 134 | if l == 40: |
|
135 | 135 | return st[:20], st[20:40] |
|
136 | 136 | elif l > 0 and l < 40: |
|
137 |
raise |
|
|
137 | raise error.Abort(_('working directory state appears damaged!')) | |
|
138 | 138 | except IOError as err: |
|
139 | 139 | if err.errno != errno.ENOENT: |
|
140 | 140 | raise |
@@ -412,13 +412,13 class dirstate(object): | |||
|
412 | 412 | if state == 'a' or oldstate == 'r': |
|
413 | 413 | scmutil.checkfilename(f) |
|
414 | 414 | if f in self._dirs: |
|
415 |
raise |
|
|
415 | raise error.Abort(_('directory %r already in dirstate') % f) | |
|
416 | 416 | # shadows |
|
417 | 417 | for d in util.finddirs(f): |
|
418 | 418 | if d in self._dirs: |
|
419 | 419 | break |
|
420 | 420 | if d in self._map and self[d] != 'r': |
|
421 |
raise |
|
|
421 | raise error.Abort( | |
|
422 | 422 | _('file %r in dirstate clashes with %r') % (d, f)) |
|
423 | 423 | if oldstate in "?r" and "_dirs" in self.__dict__: |
|
424 | 424 | self._dirs.addpath(f) |
@@ -464,7 +464,7 class dirstate(object): | |||
|
464 | 464 | def otherparent(self, f): |
|
465 | 465 | '''Mark as coming from the other parent, always dirty.''' |
|
466 | 466 | if self._pl[1] == nullid: |
|
467 |
raise |
|
|
467 | raise error.Abort(_("setting %r to other parent " | |
|
468 | 468 | "only allowed in merges") % f) |
|
469 | 469 | if f in self and self[f] == 'n': |
|
470 | 470 | # merge-like |
@@ -16,6 +16,7 from .node import ( | |||
|
16 | 16 | from . import ( |
|
17 | 17 | bookmarks, |
|
18 | 18 | branchmap, |
|
19 | error, | |
|
19 | 20 | obsolete, |
|
20 | 21 | phases, |
|
21 | 22 | setdiscovery, |
@@ -262,7 +263,7 def checkheads(repo, remote, outgoing, r | |||
|
262 | 263 | # 1. Check for new branches on the remote. |
|
263 | 264 | if newbranches and not newbranch: # new branch requires --new-branch |
|
264 | 265 | branchnames = ', '.join(sorted(newbranches)) |
|
265 |
raise |
|
|
266 | raise error.Abort(_("push creates new remote branches: %s!") | |
|
266 | 267 | % branchnames, |
|
267 | 268 | hint=_("use 'hg push --new-branch' to create" |
|
268 | 269 | " new remote branches")) |
@@ -390,4 +391,4 def checkheads(repo, remote, outgoing, r | |||
|
390 | 391 | for h in dhs: |
|
391 | 392 | repo.ui.note((" %s\n") % short(h)) |
|
392 | 393 | if errormsg: |
|
393 |
raise |
|
|
394 | raise error.Abort(errormsg, hint=hint) |
@@ -100,7 +100,7 def dispatch(req): | |||
|
100 | 100 | req.ui.fout = req.fout |
|
101 | 101 | if req.ferr: |
|
102 | 102 | req.ui.ferr = req.ferr |
|
103 |
except |
|
|
103 | except error.Abort as inst: | |
|
104 | 104 | ferr.write(_("abort: %s\n") % inst) |
|
105 | 105 | if inst.hint: |
|
106 | 106 | ferr.write(_("(%s)\n") % inst.hint) |
@@ -253,7 +253,7 def _runcatch(req): | |||
|
253 | 253 | # check if the command is in a disabled extension |
|
254 | 254 | # (but don't check for extensions themselves) |
|
255 | 255 | commands.help_(ui, inst.args[0], unknowncmd=True) |
|
256 |
except (error.UnknownCommand, |
|
|
256 | except (error.UnknownCommand, error.Abort): | |
|
257 | 257 | suggested = False |
|
258 | 258 | if len(inst.args) == 2: |
|
259 | 259 | sim = _getsimilar(inst.args[1], inst.args[0]) |
@@ -266,7 +266,7 def _runcatch(req): | |||
|
266 | 266 | except error.InterventionRequired as inst: |
|
267 | 267 | ui.warn("%s\n" % inst) |
|
268 | 268 | return 1 |
|
269 |
except |
|
|
269 | except error.Abort as inst: | |
|
270 | 270 | ui.warn(_("abort: %s\n") % inst) |
|
271 | 271 | if inst.hint: |
|
272 | 272 | ui.warn(_("(%s)\n") % inst.hint) |
@@ -398,7 +398,7 def aliasargs(fn, givenargs): | |||
|
398 | 398 | nums.append(num) |
|
399 | 399 | if num < len(givenargs): |
|
400 | 400 | return givenargs[num] |
|
401 |
raise |
|
|
401 | raise error.Abort(_('too few arguments for command alias')) | |
|
402 | 402 | cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) |
|
403 | 403 | givenargs = [x for i, x in enumerate(givenargs) |
|
404 | 404 | if i not in nums] |
@@ -525,7 +525,7 class cmdalias(object): | |||
|
525 | 525 | hint = _("'%s' is provided by '%s' extension") % (cmd, ext) |
|
526 | 526 | except error.UnknownCommand: |
|
527 | 527 | pass |
|
528 |
raise |
|
|
528 | raise error.Abort(self.badalias, hint=hint) | |
|
529 | 529 | if self.shadows: |
|
530 | 530 | ui.debug("alias '%s' shadows command '%s'\n" % |
|
531 | 531 | (self.name, self.cmdname)) |
@@ -614,7 +614,7 def _parseconfig(ui, config): | |||
|
614 | 614 | ui.setconfig(section, name, value, '--config') |
|
615 | 615 | configs.append((section, name, value)) |
|
616 | 616 | except (IndexError, ValueError): |
|
617 |
raise |
|
|
617 | raise error.Abort(_('malformed --config option: %r ' | |
|
618 | 618 | '(use --config section.name=value)') % cfg) |
|
619 | 619 | |
|
620 | 620 | return configs |
@@ -690,7 +690,7 def _getlocal(ui, rpath): | |||
|
690 | 690 | try: |
|
691 | 691 | wd = os.getcwd() |
|
692 | 692 | except OSError as e: |
|
693 |
raise |
|
|
693 | raise error.Abort(_("error getting current working directory: %s") % | |
|
694 | 694 | e.strerror) |
|
695 | 695 | path = cmdutil.findrepo(wd) or "" |
|
696 | 696 | if not path: |
@@ -813,11 +813,11 def _dispatch(req): | |||
|
813 | 813 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
814 | 814 | |
|
815 | 815 | if options["config"]: |
|
816 |
raise |
|
|
816 | raise error.Abort(_("option --config may not be abbreviated!")) | |
|
817 | 817 | if options["cwd"]: |
|
818 |
raise |
|
|
818 | raise error.Abort(_("option --cwd may not be abbreviated!")) | |
|
819 | 819 | if options["repository"]: |
|
820 |
raise |
|
|
820 | raise error.Abort(_( | |
|
821 | 821 | "option -R has to be separated from other options (e.g. not -qR) " |
|
822 | 822 | "and --repository may only be abbreviated as --repo!")) |
|
823 | 823 | |
@@ -884,7 +884,7 def _dispatch(req): | |||
|
884 | 884 | try: |
|
885 | 885 | repo = hg.repository(ui, path=path) |
|
886 | 886 | if not repo.local(): |
|
887 |
raise |
|
|
887 | raise error.Abort(_("repository '%s' is not local") % path) | |
|
888 | 888 | repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo') |
|
889 | 889 | except error.RequirementError: |
|
890 | 890 | raise |
@@ -936,7 +936,7 def lsprofile(ui, func, fp): | |||
|
936 | 936 | try: |
|
937 | 937 | from . import lsprof |
|
938 | 938 | except ImportError: |
|
939 |
raise |
|
|
939 | raise error.Abort(_( | |
|
940 | 940 | 'lsprof not available - install from ' |
|
941 | 941 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) |
|
942 | 942 | p = lsprof.Profiler() |
@@ -960,7 +960,7 def flameprofile(ui, func, fp): | |||
|
960 | 960 | try: |
|
961 | 961 | from flamegraph import flamegraph |
|
962 | 962 | except ImportError: |
|
963 |
raise |
|
|
963 | raise error.Abort(_( | |
|
964 | 964 | 'flamegraph not available - install from ' |
|
965 | 965 | 'https://github.com/evanhempel/python-flamegraph')) |
|
966 | 966 | # developer config: profiling.freq |
@@ -985,7 +985,7 def statprofile(ui, func, fp): | |||
|
985 | 985 | try: |
|
986 | 986 | import statprof |
|
987 | 987 | except ImportError: |
|
988 |
raise |
|
|
988 | raise error.Abort(_( | |
|
989 | 989 | 'statprof not available - install using "easy_install statprof"')) |
|
990 | 990 | |
|
991 | 991 | freq = ui.configint('profiling', 'freq', default=1000) |
@@ -30,7 +30,7 def readbundle(ui, fh, fname, vfs=None): | |||
|
30 | 30 | magic, version = header[0:2], header[2:4] |
|
31 | 31 | |
|
32 | 32 | if magic != 'HG': |
|
33 |
raise |
|
|
33 | raise error.Abort(_('%s: not a Mercurial bundle') % fname) | |
|
34 | 34 | if version == '10': |
|
35 | 35 | if alg is None: |
|
36 | 36 | alg = changegroup.readexactly(fh, 2) |
@@ -38,7 +38,7 def readbundle(ui, fh, fname, vfs=None): | |||
|
38 | 38 | elif version.startswith('2'): |
|
39 | 39 | return bundle2.getunbundler(ui, fh, magicstring=magic + version) |
|
40 | 40 | else: |
|
41 |
raise |
|
|
41 | raise error.Abort(_('%s: unknown bundle version %s') % (fname, version)) | |
|
42 | 42 | |
|
43 | 43 | def buildobsmarkerspart(bundler, markers): |
|
44 | 44 | """add an obsmarker part to the bundler with <markers> |
@@ -193,7 +193,7 def push(repo, remote, force=False, revs | |||
|
193 | 193 | msg = _("required features are not" |
|
194 | 194 | " supported in the destination:" |
|
195 | 195 | " %s") % (', '.join(sorted(missing))) |
|
196 |
raise |
|
|
196 | raise error.Abort(msg) | |
|
197 | 197 | |
|
198 | 198 | # there are two ways to push to remote repo: |
|
199 | 199 | # |
@@ -204,7 +204,7 def push(repo, remote, force=False, revs | |||
|
204 | 204 | # servers, http servers). |
|
205 | 205 | |
|
206 | 206 | if not pushop.remote.canpush(): |
|
207 |
raise |
|
|
207 | raise error.Abort(_("destination does not support push")) | |
|
208 | 208 | # get local lock as we might write phase data |
|
209 | 209 | localwlock = locallock = None |
|
210 | 210 | try: |
@@ -435,9 +435,9 def _pushcheckoutgoing(pushop): | |||
|
435 | 435 | for node in outgoing.missingheads: |
|
436 | 436 | ctx = unfi[node] |
|
437 | 437 | if ctx.obsolete(): |
|
438 |
raise |
|
|
438 | raise error.Abort(mso % ctx) | |
|
439 | 439 | elif ctx.troubled(): |
|
440 |
raise |
|
|
440 | raise error.Abort(mst[ctx.troubles()[0]] % ctx) | |
|
441 | 441 | |
|
442 | 442 | # internal config: bookmarks.pushing |
|
443 | 443 | newbm = pushop.ui.configlist('bookmarks', 'pushing') |
@@ -658,14 +658,14 def _pushbundle2(pushop): | |||
|
658 | 658 | try: |
|
659 | 659 | reply = pushop.remote.unbundle(stream, ['force'], 'push') |
|
660 | 660 | except error.BundleValueError as exc: |
|
661 |
raise |
|
|
661 | raise error.Abort('missing support for %s' % exc) | |
|
662 | 662 | try: |
|
663 | 663 | trgetter = None |
|
664 | 664 | if pushback: |
|
665 | 665 | trgetter = pushop.trmanager.transaction |
|
666 | 666 | op = bundle2.processbundle(pushop.repo, reply, trgetter) |
|
667 | 667 | except error.BundleValueError as exc: |
|
668 |
raise |
|
|
668 | raise error.Abort('missing support for %s' % exc) | |
|
669 | 669 | except error.PushkeyFailed as exc: |
|
670 | 670 | partid = int(exc.partid) |
|
671 | 671 | if partid not in pushop.pkfailcb: |
@@ -967,7 +967,7 def pull(repo, remote, heads=None, force | |||
|
967 | 967 | msg = _("required features are not" |
|
968 | 968 | " supported in the destination:" |
|
969 | 969 | " %s") % (', '.join(sorted(missing))) |
|
970 |
raise |
|
|
970 | raise error.Abort(msg) | |
|
971 | 971 | |
|
972 | 972 | lock = pullop.repo.lock() |
|
973 | 973 | try: |
@@ -1108,7 +1108,7 def _pullbundle2(pullop): | |||
|
1108 | 1108 | try: |
|
1109 | 1109 | op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) |
|
1110 | 1110 | except error.BundleValueError as exc: |
|
1111 |
raise |
|
|
1111 | raise error.Abort('missing support for %s' % exc) | |
|
1112 | 1112 | |
|
1113 | 1113 | if pullop.fetch: |
|
1114 | 1114 | results = [cg['return'] for cg in op.records['changegroup']] |
@@ -1158,7 +1158,7 def _pullchangeset(pullop): | |||
|
1158 | 1158 | elif pullop.heads is None: |
|
1159 | 1159 | cg = pullop.remote.changegroup(pullop.fetch, 'pull') |
|
1160 | 1160 | elif not pullop.remote.capable('changegroupsubset'): |
|
1161 |
raise |
|
|
1161 | raise error.Abort(_("partial pull cannot be done because " | |
|
1162 | 1162 | "other repository doesn't support " |
|
1163 | 1163 | "changegroupsubset.")) |
|
1164 | 1164 | else: |
@@ -10,7 +10,7 from __future__ import absolute_import | |||
|
10 | 10 | import getopt |
|
11 | 11 | |
|
12 | 12 | from .i18n import _ |
|
13 |
from . import |
|
|
13 | from . import error | |
|
14 | 14 | |
|
15 | 15 | def gnugetopt(args, options, longoptions): |
|
16 | 16 | """Parse options mostly like getopt.gnu_getopt. |
@@ -114,7 +114,7 def fancyopts(args, options, state, gnu= | |||
|
114 | 114 | try: |
|
115 | 115 | state[name] = int(val) |
|
116 | 116 | except ValueError: |
|
117 |
raise |
|
|
117 | raise error.Abort(_('invalid value %r for option %s, ' | |
|
118 | 118 | 'expected int') % (val, opt)) |
|
119 | 119 | elif t is type(''): |
|
120 | 120 | state[name] = val |
@@ -363,7 +363,7 def encoding(mctx, x): | |||
|
363 | 363 | try: |
|
364 | 364 | d.decode(enc) |
|
365 | 365 | except LookupError: |
|
366 |
raise |
|
|
366 | raise error.Abort(_("unknown encoding '%s'") % enc) | |
|
367 | 367 | except UnicodeDecodeError: |
|
368 | 368 | continue |
|
369 | 369 | s.append(f) |
@@ -18,8 +18,8 from .node import ( | |||
|
18 | 18 | |
|
19 | 19 | from . import ( |
|
20 | 20 | encoding, |
|
21 | error, | |
|
21 | 22 | templater, |
|
22 | util, | |
|
23 | 23 | ) |
|
24 | 24 | |
|
25 | 25 | class baseformatter(object): |
@@ -179,7 +179,7 def lookuptemplate(ui, topic, tmpl): | |||
|
179 | 179 | |
|
180 | 180 | if tmpl == 'list': |
|
181 | 181 | ui.write(_("available styles: %s\n") % templater.stylelist()) |
|
182 |
raise |
|
|
182 | raise error.Abort(_("specify a template")) | |
|
183 | 183 | |
|
184 | 184 | # perhaps it's a path to a map or a template |
|
185 | 185 | if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl): |
@@ -20,7 +20,6 from .node import ( | |||
|
20 | 20 | ) |
|
21 | 21 | from . import ( |
|
22 | 22 | error, |
|
23 | util, | |
|
24 | 23 | ) |
|
25 | 24 | |
|
26 | 25 | def bisect(changelog, state): |
@@ -74,8 +73,8 def bisect(changelog, state): | |||
|
74 | 73 | if not ancestors: # now we're confused |
|
75 | 74 | if (len(state['bad']) == 1 and len(state['good']) == 1 and |
|
76 | 75 | state['bad'] != state['good']): |
|
77 |
raise |
|
|
78 |
raise |
|
|
76 | raise error.Abort(_("starting revisions are not directly related")) | |
|
77 | raise error.Abort(_("inconsistent state, %s:%s is good and bad") | |
|
79 | 78 | % (badrev, short(bad))) |
|
80 | 79 | |
|
81 | 80 | # build children dict |
@@ -149,7 +148,7 def load_state(repo): | |||
|
149 | 148 | kind, node = l[:-1].split() |
|
150 | 149 | node = repo.lookup(node) |
|
151 | 150 | if kind not in state: |
|
152 |
raise |
|
|
151 | raise error.Abort(_("unknown bisect kind %s") % kind) | |
|
153 | 152 | state[kind].append(node) |
|
154 | 153 | return state |
|
155 | 154 |
@@ -502,7 +502,7 def help_(ui, name, unknowncmd=False, fu | |||
|
502 | 502 | if not rst: |
|
503 | 503 | msg = _('no matches') |
|
504 | 504 | hint = _('try "hg help" for a list of topics') |
|
505 |
raise |
|
|
505 | raise error.Abort(msg, hint=hint) | |
|
506 | 506 | elif name and name != 'shortlist': |
|
507 | 507 | queries = [] |
|
508 | 508 | if unknowncmd: |
@@ -525,7 +525,7 def help_(ui, name, unknowncmd=False, fu | |||
|
525 | 525 | else: |
|
526 | 526 | msg = _('no such help topic: %s') % name |
|
527 | 527 | hint = _('try "hg help --keyword %s"') % name |
|
528 |
raise |
|
|
528 | raise error.Abort(msg, hint=hint) | |
|
529 | 529 | else: |
|
530 | 530 | # program name |
|
531 | 531 | if not ui.quiet: |
@@ -65,7 +65,7 def addbranchrevs(lrepo, other, branches | |||
|
65 | 65 | |
|
66 | 66 | if not peer.capable('branchmap'): |
|
67 | 67 | if branches: |
|
68 |
raise |
|
|
68 | raise error.Abort(_("remote branch lookup not supported")) | |
|
69 | 69 | revs.append(hashbranch) |
|
70 | 70 | return revs, revs[0] |
|
71 | 71 | branchmap = peer.branchmap() |
@@ -73,7 +73,7 def addbranchrevs(lrepo, other, branches | |||
|
73 | 73 | def primary(branch): |
|
74 | 74 | if branch == '.': |
|
75 | 75 | if not lrepo: |
|
76 |
raise |
|
|
76 | raise error.Abort(_("dirstate branch not accessible")) | |
|
77 | 77 | branch = lrepo.dirstate.branch() |
|
78 | 78 | if branch in branchmap: |
|
79 | 79 | revs.extend(node.hex(r) for r in reversed(branchmap[branch])) |
@@ -160,7 +160,7 def repository(ui, path='', create=False | |||
|
160 | 160 | peer = _peerorrepo(ui, path, create) |
|
161 | 161 | repo = peer.local() |
|
162 | 162 | if not repo: |
|
163 |
raise |
|
|
163 | raise error.Abort(_("repository '%s' is not local") % | |
|
164 | 164 | (path or peer.url())) |
|
165 | 165 | return repo.filtered('visible') |
|
166 | 166 | |
@@ -194,7 +194,7 def share(ui, source, dest=None, update= | |||
|
194 | 194 | '''create a shared repository''' |
|
195 | 195 | |
|
196 | 196 | if not islocal(source): |
|
197 |
raise |
|
|
197 | raise error.Abort(_('can only share local repositories')) | |
|
198 | 198 | |
|
199 | 199 | if not dest: |
|
200 | 200 | dest = defaultdest(source) |
@@ -217,7 +217,7 def share(ui, source, dest=None, update= | |||
|
217 | 217 | destvfs = scmutil.vfs(os.path.join(destwvfs.base, '.hg'), realpath=True) |
|
218 | 218 | |
|
219 | 219 | if destvfs.lexists(): |
|
220 |
raise |
|
|
220 | raise error.Abort(_('destination already exists')) | |
|
221 | 221 | |
|
222 | 222 | if not destwvfs.isdir(): |
|
223 | 223 | destwvfs.mkdir() |
@@ -320,7 +320,7 def clonewithshare(ui, peeropts, sharepa | |||
|
320 | 320 | revs = None |
|
321 | 321 | if rev: |
|
322 | 322 | if not srcpeer.capable('lookup'): |
|
323 |
raise |
|
|
323 | raise error.Abort(_("src repository does not support " | |
|
324 | 324 | "revision lookup and so doesn't " |
|
325 | 325 | "support clone by revision")) |
|
326 | 326 | revs = [srcpeer.lookup(r) for r in rev] |
@@ -416,14 +416,14 def clone(ui, peeropts, source, dest=Non | |||
|
416 | 416 | source = util.urllocalpath(source) |
|
417 | 417 | |
|
418 | 418 | if not dest: |
|
419 |
raise |
|
|
419 | raise error.Abort(_("empty destination path is not valid")) | |
|
420 | 420 | |
|
421 | 421 | destvfs = scmutil.vfs(dest, expandpath=True) |
|
422 | 422 | if destvfs.lexists(): |
|
423 | 423 | if not destvfs.isdir(): |
|
424 |
raise |
|
|
424 | raise error.Abort(_("destination '%s' already exists") % dest) | |
|
425 | 425 | elif destvfs.listdir(): |
|
426 |
raise |
|
|
426 | raise error.Abort(_("destination '%s' is not empty") % dest) | |
|
427 | 427 | |
|
428 | 428 | shareopts = shareopts or {} |
|
429 | 429 | sharepool = shareopts.get('pool') |
@@ -448,7 +448,7 def clone(ui, peeropts, source, dest=Non | |||
|
448 | 448 | elif sharenamemode == 'remote': |
|
449 | 449 | sharepath = os.path.join(sharepool, util.sha1(source).hexdigest()) |
|
450 | 450 | else: |
|
451 |
raise |
|
|
451 | raise error.Abort('unknown share naming mode: %s' % sharenamemode) | |
|
452 | 452 | |
|
453 | 453 | if sharepath: |
|
454 | 454 | return clonewithshare(ui, peeropts, sharepath, source, srcpeer, |
@@ -494,7 +494,7 def clone(ui, peeropts, source, dest=Non | |||
|
494 | 494 | except OSError as inst: |
|
495 | 495 | if inst.errno == errno.EEXIST: |
|
496 | 496 | cleandir = None |
|
497 |
raise |
|
|
497 | raise error.Abort(_("destination '%s' already exists") | |
|
498 | 498 | % dest) |
|
499 | 499 | raise |
|
500 | 500 | |
@@ -534,14 +534,14 def clone(ui, peeropts, source, dest=Non | |||
|
534 | 534 | except OSError as inst: |
|
535 | 535 | if inst.errno == errno.EEXIST: |
|
536 | 536 | cleandir = None |
|
537 |
raise |
|
|
537 | raise error.Abort(_("destination '%s' already exists") | |
|
538 | 538 | % dest) |
|
539 | 539 | raise |
|
540 | 540 | |
|
541 | 541 | revs = None |
|
542 | 542 | if rev: |
|
543 | 543 | if not srcpeer.capable('lookup'): |
|
544 |
raise |
|
|
544 | raise error.Abort(_("src repository does not support " | |
|
545 | 545 | "revision lookup and so doesn't " |
|
546 | 546 | "support clone by revision")) |
|
547 | 547 | revs = [srcpeer.lookup(r) for r in rev] |
@@ -557,7 +557,8 def clone(ui, peeropts, source, dest=Non | |||
|
557 | 557 | exchange.push(srcrepo, destpeer, revs=revs, |
|
558 | 558 | bookmarks=srcrepo._bookmarks.keys()) |
|
559 | 559 | else: |
|
560 |
raise |
|
|
560 | raise error.Abort(_("clone from remote to remote not supported") | |
|
561 | ) | |
|
561 | 562 | |
|
562 | 563 | cleandir = None |
|
563 | 564 |
@@ -118,7 +118,7 class hgwebdir(object): | |||
|
118 | 118 | if not isinstance(self.conf, (dict, list, tuple)): |
|
119 | 119 | map = {'paths': 'hgweb-paths'} |
|
120 | 120 | if not os.path.exists(self.conf): |
|
121 |
raise |
|
|
121 | raise error.Abort(_('config file %s not found!') % self.conf) | |
|
122 | 122 | u.readconfig(self.conf, remap=map, trust=True) |
|
123 | 123 | paths = [] |
|
124 | 124 | for name, ignored in u.configitems('hgweb-paths'): |
@@ -208,7 +208,7 class _httprequesthandleropenssl(_httpre | |||
|
208 | 208 | import OpenSSL |
|
209 | 209 | OpenSSL.SSL.Context |
|
210 | 210 | except ImportError: |
|
211 |
raise |
|
|
211 | raise error.Abort(_("SSL support is unavailable")) | |
|
212 | 212 | ctx = OpenSSL.SSL.Context(OpenSSL.SSL.TLSv1_METHOD) |
|
213 | 213 | ctx.use_privatekey_file(ssl_cert) |
|
214 | 214 | ctx.use_certificate_file(ssl_cert) |
@@ -249,7 +249,7 class _httprequesthandlerssl(_httpreques | |||
|
249 | 249 | import ssl |
|
250 | 250 | ssl.wrap_socket |
|
251 | 251 | except ImportError: |
|
252 |
raise |
|
|
252 | raise error.Abort(_("SSL support is unavailable")) | |
|
253 | 253 | httpserver.socket = ssl.wrap_socket( |
|
254 | 254 | httpserver.socket, server_side=True, |
|
255 | 255 | certfile=ssl_cert, ssl_version=ssl.PROTOCOL_TLSv1) |
@@ -345,5 +345,5 def create_server(ui, app): | |||
|
345 | 345 | try: |
|
346 | 346 | return cls(ui, app, (address, port), handler) |
|
347 | 347 | except socket.error as inst: |
|
348 |
raise |
|
|
348 | raise error.Abort(_("cannot start server at '%s:%d': %s") | |
|
349 | 349 | % (address, port, inst.args[1])) |
@@ -35,7 +35,7 def _pythonhook(ui, repo, name, hname, f | |||
|
35 | 35 | else: |
|
36 | 36 | d = funcname.rfind('.') |
|
37 | 37 | if d == -1: |
|
38 |
raise |
|
|
38 | raise error.Abort(_('%s hook is invalid ("%s" not in ' | |
|
39 | 39 | 'a module)') % (hname, funcname)) |
|
40 | 40 | modname = funcname[:d] |
|
41 | 41 | oldpaths = sys.path |
@@ -63,7 +63,7 def _pythonhook(ui, repo, name, hname, f | |||
|
63 | 63 | ui.warn(_('exception from second failed import ' |
|
64 | 64 | 'attempt:\n')) |
|
65 | 65 | ui.traceback(e2) |
|
66 |
raise |
|
|
66 | raise error.Abort(_('%s hook is invalid ' | |
|
67 | 67 | '(import of "%s" failed)') % |
|
68 | 68 | (hname, modname)) |
|
69 | 69 | sys.path = oldpaths |
@@ -71,11 +71,11 def _pythonhook(ui, repo, name, hname, f | |||
|
71 | 71 | for p in funcname.split('.')[1:]: |
|
72 | 72 | obj = getattr(obj, p) |
|
73 | 73 | except AttributeError: |
|
74 |
raise |
|
|
74 | raise error.Abort(_('%s hook is invalid ' | |
|
75 | 75 | '("%s" is not defined)') % |
|
76 | 76 | (hname, funcname)) |
|
77 | 77 | if not callable(obj): |
|
78 |
raise |
|
|
78 | raise error.Abort(_('%s hook is invalid ' | |
|
79 | 79 | '("%s" is not callable)') % |
|
80 | 80 | (hname, funcname)) |
|
81 | 81 | |
@@ -91,7 +91,7 def _pythonhook(ui, repo, name, hname, f | |||
|
91 | 91 | |
|
92 | 92 | r = obj(ui=ui, repo=repo, hooktype=name, **args) |
|
93 | 93 | except Exception as exc: |
|
94 |
if isinstance(exc, |
|
|
94 | if isinstance(exc, error.Abort): | |
|
95 | 95 | ui.warn(_('error: %s hook failed: %s\n') % |
|
96 | 96 | (hname, exc.args[0])) |
|
97 | 97 | else: |
@@ -49,7 +49,7 class httppeer(wireproto.wirepeer): | |||
|
49 | 49 | self.requestbuilder = None |
|
50 | 50 | u = util.url(path) |
|
51 | 51 | if u.query or u.fragment: |
|
52 |
raise |
|
|
52 | raise error.Abort(_('unsupported URL component: "%s"') % | |
|
53 | 53 | (u.query or u.fragment)) |
|
54 | 54 | |
|
55 | 55 | # urllib cannot handle URLs with embedded user or passwd |
@@ -86,7 +86,7 class httppeer(wireproto.wirepeer): | |||
|
86 | 86 | return self.caps |
|
87 | 87 | |
|
88 | 88 | def lock(self): |
|
89 |
raise |
|
|
89 | raise error.Abort(_('operation not supported over http')) | |
|
90 | 90 | |
|
91 | 91 | def _callstream(self, cmd, **args): |
|
92 | 92 | if cmd == 'pushkey': |
@@ -137,7 +137,7 class httppeer(wireproto.wirepeer): | |||
|
137 | 137 | resp = self.urlopener.open(req) |
|
138 | 138 | except urllib2.HTTPError as inst: |
|
139 | 139 | if inst.code == 401: |
|
140 |
raise |
|
|
140 | raise error.Abort(_('authorization failed')) | |
|
141 | 141 | raise |
|
142 | 142 | except httplib.HTTPException as inst: |
|
143 | 143 | self.ui.debug('http error while sending %s command\n' % cmd) |
@@ -145,7 +145,7 class httppeer(wireproto.wirepeer): | |||
|
145 | 145 | raise IOError(None, inst) |
|
146 | 146 | except IndexError: |
|
147 | 147 | # this only happens with Python 2.3, later versions raise URLError |
|
148 |
raise |
|
|
148 | raise error.Abort(_('http error, possibly caused by proxy setting')) | |
|
149 | 149 | # record the url we got redirected to |
|
150 | 150 | resp_url = resp.geturl() |
|
151 | 151 | if resp_url.endswith(qs): |
@@ -223,8 +223,8 class httppeer(wireproto.wirepeer): | |||
|
223 | 223 | return vals |
|
224 | 224 | except socket.error as err: |
|
225 | 225 | if err.args[0] in (errno.ECONNRESET, errno.EPIPE): |
|
226 |
raise |
|
|
227 |
raise |
|
|
226 | raise error.Abort(_('push failed: %s') % err.args[1]) | |
|
227 | raise error.Abort(err.args[1]) | |
|
228 | 228 | finally: |
|
229 | 229 | fp.close() |
|
230 | 230 | os.unlink(tempname) |
@@ -263,13 +263,13 class httppeer(wireproto.wirepeer): | |||
|
263 | 263 | class httpspeer(httppeer): |
|
264 | 264 | def __init__(self, ui, path): |
|
265 | 265 | if not url.has_https: |
|
266 |
raise |
|
|
266 | raise error.Abort(_('Python support for SSL and HTTPS ' | |
|
267 | 267 | 'is not installed')) |
|
268 | 268 | httppeer.__init__(self, ui, path) |
|
269 | 269 | |
|
270 | 270 | def instance(ui, path, create): |
|
271 | 271 | if create: |
|
272 |
raise |
|
|
272 | raise error.Abort(_('cannot create new http repository')) | |
|
273 | 273 | try: |
|
274 | 274 | if path.startswith('https:'): |
|
275 | 275 | inst = httpspeer(ui, path) |
@@ -640,7 +640,7 class localrepository(object): | |||
|
640 | 640 | if not local: |
|
641 | 641 | m = matchmod.exact(self.root, '', ['.hgtags']) |
|
642 | 642 | if any(self.status(match=m, unknown=True, ignored=True)): |
|
643 |
raise |
|
|
643 | raise error.Abort(_('working copy of .hgtags is changed'), | |
|
644 | 644 | hint=_('please commit .hgtags manually')) |
|
645 | 645 | |
|
646 | 646 | self.tags() # instantiate the cache |
@@ -1119,7 +1119,7 class localrepository(object): | |||
|
1119 | 1119 | desc = None |
|
1120 | 1120 | |
|
1121 | 1121 | if not force and self['.'] != self['tip'] and desc == 'commit': |
|
1122 |
raise |
|
|
1122 | raise error.Abort( | |
|
1123 | 1123 | _('rollback of last commit while not checked out ' |
|
1124 | 1124 | 'may lose data'), hint=_('use -f to force')) |
|
1125 | 1125 | |
@@ -1433,7 +1433,7 class localrepository(object): | |||
|
1433 | 1433 | extra = {} |
|
1434 | 1434 | |
|
1435 | 1435 | def fail(f, msg): |
|
1436 |
raise |
|
|
1436 | raise error.Abort('%s: %s' % (f, msg)) | |
|
1437 | 1437 | |
|
1438 | 1438 | if not match: |
|
1439 | 1439 | match = matchmod.always(self.root, '') |
@@ -1449,7 +1449,7 class localrepository(object): | |||
|
1449 | 1449 | merge = len(wctx.parents()) > 1 |
|
1450 | 1450 | |
|
1451 | 1451 | if not force and merge and match.ispartial(): |
|
1452 |
raise |
|
|
1452 | raise error.Abort(_('cannot partially commit a merge ' | |
|
1453 | 1453 | '(do not specify files or patterns)')) |
|
1454 | 1454 | |
|
1455 | 1455 | status = self.status(match=match, clean=force) |
@@ -1477,12 +1477,12 class localrepository(object): | |||
|
1477 | 1477 | newstate[s] = oldstate[s] |
|
1478 | 1478 | continue |
|
1479 | 1479 | if not force: |
|
1480 |
raise |
|
|
1480 | raise error.Abort( | |
|
1481 | 1481 | _("commit with new subrepo %s excluded") % s) |
|
1482 | 1482 | dirtyreason = wctx.sub(s).dirtyreason(True) |
|
1483 | 1483 | if dirtyreason: |
|
1484 | 1484 | if not self.ui.configbool('ui', 'commitsubrepos'): |
|
1485 |
raise |
|
|
1485 | raise error.Abort(dirtyreason, | |
|
1486 | 1486 | hint=_("use --subrepos for recursive commit")) |
|
1487 | 1487 | subs.append(s) |
|
1488 | 1488 | commitsubs.add(s) |
@@ -1499,7 +1499,7 class localrepository(object): | |||
|
1499 | 1499 | if subs: |
|
1500 | 1500 | if (not match('.hgsub') and |
|
1501 | 1501 | '.hgsub' in (wctx.modified() + wctx.added())): |
|
1502 |
raise |
|
|
1502 | raise error.Abort( | |
|
1503 | 1503 | _("can't commit subrepos without .hgsub")) |
|
1504 | 1504 | status.modified.insert(0, '.hgsubstate') |
|
1505 | 1505 | |
@@ -1541,12 +1541,12 class localrepository(object): | |||
|
1541 | 1541 | return None |
|
1542 | 1542 | |
|
1543 | 1543 | if merge and cctx.deleted(): |
|
1544 |
raise |
|
|
1544 | raise error.Abort(_("cannot commit merge with missing files")) | |
|
1545 | 1545 | |
|
1546 | 1546 | ms = mergemod.mergestate(self) |
|
1547 | 1547 | for f in status.modified: |
|
1548 | 1548 | if f in ms and ms[f] == 'u': |
|
1549 |
raise |
|
|
1549 | raise error.Abort(_('unresolved merge conflicts ' | |
|
1550 | 1550 | '(see "hg help resolve")')) |
|
1551 | 1551 | |
|
1552 | 1552 | if editor: |
@@ -18,6 +18,7 import time | |||
|
18 | 18 | from .i18n import _ |
|
19 | 19 | from . import ( |
|
20 | 20 | encoding, |
|
21 | error, | |
|
21 | 22 | sslutil, |
|
22 | 23 | util, |
|
23 | 24 | ) |
@@ -93,7 +94,7 if util.safehasattr(smtplib.SMTP, '_get_ | |||
|
93 | 94 | return new_socket |
|
94 | 95 | else: |
|
95 | 96 | def SMTPS(sslkwargs, keyfile=None, certfile=None, **kwargs): |
|
96 |
raise |
|
|
97 | raise error.Abort(_('SMTPS requires Python 2.6 or later')) | |
|
97 | 98 | |
|
98 | 99 | def _smtp(ui): |
|
99 | 100 | '''build an smtp connection and return a function to send mail''' |
@@ -103,14 +104,14 def _smtp(ui): | |||
|
103 | 104 | starttls = tls == 'starttls' or util.parsebool(tls) |
|
104 | 105 | smtps = tls == 'smtps' |
|
105 | 106 | if (starttls or smtps) and not util.safehasattr(socket, 'ssl'): |
|
106 |
raise |
|
|
107 | raise error.Abort(_("can't use TLS: Python SSL support not installed")) | |
|
107 | 108 | mailhost = ui.config('smtp', 'host') |
|
108 | 109 | if not mailhost: |
|
109 |
raise |
|
|
110 | raise error.Abort(_('smtp.host not configured - cannot send mail')) | |
|
110 | 111 | verifycert = ui.config('smtp', 'verifycert', 'strict') |
|
111 | 112 | if verifycert not in ['strict', 'loose']: |
|
112 | 113 | if util.parsebool(verifycert) is not False: |
|
113 |
raise |
|
|
114 | raise error.Abort(_('invalid smtp.verifycert configuration: %s') | |
|
114 | 115 | % (verifycert)) |
|
115 | 116 | verifycert = False |
|
116 | 117 | if (starttls or smtps) and verifycert: |
@@ -151,16 +152,16 def _smtp(ui): | |||
|
151 | 152 | try: |
|
152 | 153 | s.login(username, password) |
|
153 | 154 | except smtplib.SMTPException as inst: |
|
154 |
raise |
|
|
155 | raise error.Abort(inst) | |
|
155 | 156 | |
|
156 | 157 | def send(sender, recipients, msg): |
|
157 | 158 | try: |
|
158 | 159 | return s.sendmail(sender, recipients, msg) |
|
159 | 160 | except smtplib.SMTPRecipientsRefused as inst: |
|
160 | 161 | recipients = [r[1] for r in inst.recipients.values()] |
|
161 |
raise |
|
|
162 | raise error.Abort('\n' + '\n'.join(recipients)) | |
|
162 | 163 | except smtplib.SMTPException as inst: |
|
163 |
raise |
|
|
164 | raise error.Abort(inst) | |
|
164 | 165 | |
|
165 | 166 | return send |
|
166 | 167 | |
@@ -174,7 +175,7 def _sendmail(ui, sender, recipients, ms | |||
|
174 | 175 | fp.write(msg) |
|
175 | 176 | ret = fp.close() |
|
176 | 177 | if ret: |
|
177 |
raise |
|
|
178 | raise error.Abort('%s %s' % ( | |
|
178 | 179 | os.path.basename(program.split(None, 1)[0]), |
|
179 | 180 | util.explainexit(ret)[0])) |
|
180 | 181 | |
@@ -208,11 +209,11 def validateconfig(ui): | |||
|
208 | 209 | method = ui.config('email', 'method', 'smtp') |
|
209 | 210 | if method == 'smtp': |
|
210 | 211 | if not ui.config('smtp', 'host'): |
|
211 |
raise |
|
|
212 | raise error.Abort(_('smtp specified as email transport, ' | |
|
212 | 213 | 'but no smtp host configured')) |
|
213 | 214 | else: |
|
214 | 215 | if not util.findexe(method): |
|
215 |
raise |
|
|
216 | raise error.Abort(_('%r specified as email transport, ' | |
|
216 | 217 | 'but not in PATH') % method) |
|
217 | 218 | |
|
218 | 219 | def mimetextpatch(s, subtype='plain', display=False): |
@@ -302,13 +303,13 def _addressencode(ui, name, addr, chars | |||
|
302 | 303 | dom = dom.decode(encoding.encoding).encode('idna') |
|
303 | 304 | addr = '%s@%s' % (acc, dom) |
|
304 | 305 | except UnicodeDecodeError: |
|
305 |
raise |
|
|
306 | raise error.Abort(_('invalid email address: %s') % addr) | |
|
306 | 307 | except ValueError: |
|
307 | 308 | try: |
|
308 | 309 | # too strict? |
|
309 | 310 | addr = addr.encode('ascii') |
|
310 | 311 | except UnicodeDecodeError: |
|
311 |
raise |
|
|
312 | raise error.Abort(_('invalid local address: %s') % addr) | |
|
312 | 313 | return email.Utils.formataddr((name, addr)) |
|
313 | 314 | |
|
314 | 315 | def addressencode(ui, address, charsets=None, display=False): |
@@ -13,6 +13,7 import re | |||
|
13 | 13 | |
|
14 | 14 | from .i18n import _ |
|
15 | 15 | from . import ( |
|
16 | error, | |
|
16 | 17 | pathutil, |
|
17 | 18 | util, |
|
18 | 19 | ) |
@@ -37,7 +38,7 def _expandsets(kindpats, ctx, listsubre | |||
|
37 | 38 | for kind, pat, source in kindpats: |
|
38 | 39 | if kind == 'set': |
|
39 | 40 | if not ctx: |
|
40 |
raise |
|
|
41 | raise error.Abort("fileset expression with no context") | |
|
41 | 42 | s = ctx.getfileset(pat) |
|
42 | 43 | fset.update(s) |
|
43 | 44 | |
@@ -290,7 +291,7 class match(object): | |||
|
290 | 291 | files = files.splitlines() |
|
291 | 292 | files = [f for f in files if f] |
|
292 | 293 | except EnvironmentError: |
|
293 |
raise |
|
|
294 | raise error.Abort(_("unable to read file list (%s)") % pat) | |
|
294 | 295 | for k, p, source in self._normalize(files, default, root, cwd, |
|
295 | 296 | auditor): |
|
296 | 297 | kindpats.append((k, p, pat)) |
@@ -302,8 +303,8 class match(object): | |||
|
302 | 303 | for k, p, source in self._normalize(includepats, default, |
|
303 | 304 | root, cwd, auditor): |
|
304 | 305 | kindpats.append((k, p, source or pat)) |
|
305 |
except |
|
|
306 |
raise |
|
|
306 | except error.Abort as inst: | |
|
307 | raise error.Abort('%s: %s' % (pat, inst[0])) | |
|
307 | 308 | except IOError as inst: |
|
308 | 309 | if self._warn: |
|
309 | 310 | self._warn(_("skipping unreadable pattern file " |
@@ -587,11 +588,11 def _buildregexmatch(kindpats, globsuffi | |||
|
587 | 588 | _rematcher('(?:%s)' % _regex(k, p, globsuffix)) |
|
588 | 589 | except re.error: |
|
589 | 590 | if s: |
|
590 |
raise |
|
|
591 | raise error.Abort(_("%s: invalid pattern (%s): %s") % | |
|
591 | 592 | (s, k, p)) |
|
592 | 593 | else: |
|
593 |
raise |
|
|
594 |
raise |
|
|
594 | raise error.Abort(_("invalid pattern (%s): %s") % (k, p)) | |
|
595 | raise error.Abort(_("invalid pattern")) | |
|
595 | 596 | |
|
596 | 597 | def _roots(kindpats): |
|
597 | 598 | '''return roots and exact explicitly listed files from patterns |
@@ -6,7 +6,7 | |||
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from i18n import _ |
|
9 | import bdiff, mpatch, util, base85 | |
|
9 | import bdiff, mpatch, util, base85, error | |
|
10 | 10 | import re, struct, zlib |
|
11 | 11 | |
|
12 | 12 | def splitnewlines(text): |
@@ -59,7 +59,7 class diffopts(object): | |||
|
59 | 59 | try: |
|
60 | 60 | self.context = int(self.context) |
|
61 | 61 | except ValueError: |
|
62 |
raise |
|
|
62 | raise error.Abort(_('diff context lines count must be ' | |
|
63 | 63 | 'an integer, not %r') % self.context) |
|
64 | 64 | |
|
65 | 65 | def copy(self, **kwargs): |
@@ -22,6 +22,7 from .node import ( | |||
|
22 | 22 | from . import ( |
|
23 | 23 | copies, |
|
24 | 24 | destutil, |
|
25 | error, | |
|
25 | 26 | filemerge, |
|
26 | 27 | obsolete, |
|
27 | 28 | subrepo, |
@@ -98,7 +99,7 class mergestate(object): | |||
|
98 | 99 | bits = record.split('\0') |
|
99 | 100 | self._state[bits[0]] = bits[1:] |
|
100 | 101 | elif not rtype.islower(): |
|
101 |
raise |
|
|
102 | raise error.Abort(_('unsupported merge state record: %s') | |
|
102 | 103 | % rtype) |
|
103 | 104 | self._dirty = False |
|
104 | 105 | |
@@ -346,7 +347,7 def _checkunknownfiles(repo, wctx, mctx, | |||
|
346 | 347 | for f in sorted(aborts): |
|
347 | 348 | repo.ui.warn(_("%s: untracked file differs\n") % f) |
|
348 | 349 | if aborts: |
|
349 |
raise |
|
|
350 | raise error.Abort(_("untracked files in working directory differ " | |
|
350 | 351 | "from files in requested revision")) |
|
351 | 352 | |
|
352 | 353 | for f, (m, args, msg) in actions.iteritems(): |
@@ -419,7 +420,7 def _checkcollision(repo, wmf, actions): | |||
|
419 | 420 | for f in sorted(pmmf): |
|
420 | 421 | fold = util.normcase(f) |
|
421 | 422 | if fold in foldmap: |
|
422 |
raise |
|
|
423 | raise error.Abort(_("case-folding collision between %s and %s") | |
|
423 | 424 | % (f, foldmap[fold])) |
|
424 | 425 | foldmap[fold] = f |
|
425 | 426 | |
@@ -1011,18 +1012,18 def update(repo, node, branchmerge, forc | |||
|
1011 | 1012 | |
|
1012 | 1013 | ### check phase |
|
1013 | 1014 | if not overwrite and len(pl) > 1: |
|
1014 |
raise |
|
|
1015 | raise error.Abort(_("outstanding uncommitted merge")) | |
|
1015 | 1016 | if branchmerge: |
|
1016 | 1017 | if pas == [p2]: |
|
1017 |
raise |
|
|
1018 | raise error.Abort(_("merging with a working directory ancestor" | |
|
1018 | 1019 | " has no effect")) |
|
1019 | 1020 | elif pas == [p1]: |
|
1020 | 1021 | if not mergeancestor and p1.branch() == p2.branch(): |
|
1021 |
raise |
|
|
1022 | raise error.Abort(_("nothing to merge"), | |
|
1022 | 1023 | hint=_("use 'hg update' " |
|
1023 | 1024 | "or check 'hg heads'")) |
|
1024 | 1025 | if not force and (wc.files() or wc.deleted()): |
|
1025 |
raise |
|
|
1026 | raise error.Abort(_("uncommitted changes"), | |
|
1026 | 1027 | hint=_("use 'hg status' to list changes")) |
|
1027 | 1028 | for s in sorted(wc.substate): |
|
1028 | 1029 | wc.sub(s).bailifchanged() |
@@ -1051,11 +1052,11 def update(repo, node, branchmerge, forc | |||
|
1051 | 1052 | else: |
|
1052 | 1053 | hint = _("commit or update --clean to discard" |
|
1053 | 1054 | " changes") |
|
1054 |
raise |
|
|
1055 | raise error.Abort(msg, hint=hint) | |
|
1055 | 1056 | else: # node is none |
|
1056 | 1057 | msg = _("not a linear update") |
|
1057 | 1058 | hint = _("merge or update --check to force update") |
|
1058 |
raise |
|
|
1059 | raise error.Abort(msg, hint=hint) | |
|
1059 | 1060 | else: |
|
1060 | 1061 | # Allow jumping branches if clean and specific rev given |
|
1061 | 1062 | pas = [p1] |
@@ -68,7 +68,7 comment associated with each format for | |||
|
68 | 68 | |
|
69 | 69 | """ |
|
70 | 70 | import errno, struct |
|
71 | import util, base85, node, parsers | |
|
71 | import util, base85, node, parsers, error | |
|
72 | 72 | import phases |
|
73 | 73 | from i18n import _ |
|
74 | 74 | |
@@ -164,7 +164,7 def _fm0readmarkers(data, off): | |||
|
164 | 164 | # (metadata will be decoded on demand) |
|
165 | 165 | metadata = data[off:off + mdsize] |
|
166 | 166 | if len(metadata) != mdsize: |
|
167 |
raise |
|
|
167 | raise error.Abort(_('parsing obsolete marker: metadata is too ' | |
|
168 | 168 | 'short, %d bytes expected, got %d') |
|
169 | 169 | % (mdsize, len(metadata))) |
|
170 | 170 | off += mdsize |
@@ -200,7 +200,7 def _fm0readmarkers(data, off): | |||
|
200 | 200 | def _fm0encodeonemarker(marker): |
|
201 | 201 | pre, sucs, flags, metadata, date, parents = marker |
|
202 | 202 | if flags & usingsha256: |
|
203 |
raise |
|
|
203 | raise error.Abort(_('cannot handle sha256 with old obsstore format')) | |
|
204 | 204 | metadata = dict(metadata) |
|
205 | 205 | time, tz = date |
|
206 | 206 | metadata['date'] = '%r %i' % (time, tz) |
@@ -414,7 +414,7 def _readmarkers(data): | |||
|
414 | 414 | diskversion = _unpack('>B', data[off:off + 1])[0] |
|
415 | 415 | off += 1 |
|
416 | 416 | if diskversion not in formats: |
|
417 |
raise |
|
|
417 | raise error.Abort(_('parsing obsolete marker: unknown version %r') | |
|
418 | 418 | % diskversion) |
|
419 | 419 | return diskversion, formats[diskversion][0](data, off) |
|
420 | 420 | |
@@ -496,7 +496,7 def _checkinvalidmarkers(markers): | |||
|
496 | 496 | """ |
|
497 | 497 | for mark in markers: |
|
498 | 498 | if node.nullid in mark[1]: |
|
499 |
raise |
|
|
499 | raise error.Abort(_('bad obsolescence marker detected: ' | |
|
500 | 500 | 'invalid successors nullid')) |
|
501 | 501 | |
|
502 | 502 | class obsstore(object): |
@@ -583,8 +583,8 class obsstore(object): | |||
|
583 | 583 | Take care of filtering duplicate. |
|
584 | 584 | Return the number of new marker.""" |
|
585 | 585 | if self._readonly: |
|
586 |
raise |
|
|
587 | 'repo') | |
|
586 | raise error.Abort('creating obsolete markers is not enabled on ' | |
|
587 | 'this repo') | |
|
588 | 588 | known = set(self._all) |
|
589 | 589 | new = [] |
|
590 | 590 | for m in markers: |
@@ -1217,7 +1217,7 def createmarkers(repo, relations, flag= | |||
|
1217 | 1217 | localmetadata.update(rel[2]) |
|
1218 | 1218 | |
|
1219 | 1219 | if not prec.mutable(): |
|
1220 |
raise |
|
|
1220 | raise error.Abort("cannot obsolete public changeset: %s" | |
|
1221 | 1221 | % prec, |
|
1222 | 1222 | hint='see "hg help phases" for details') |
|
1223 | 1223 | nprec = prec.node() |
@@ -1226,7 +1226,7 def createmarkers(repo, relations, flag= | |||
|
1226 | 1226 | if not nsucs: |
|
1227 | 1227 | npare = tuple(p.node() for p in prec.parents()) |
|
1228 | 1228 | if nprec in nsucs: |
|
1229 |
raise |
|
|
1229 | raise error.Abort("changeset %s cannot obsolete itself" % prec) | |
|
1230 | 1230 | repo.obsstore.create(tr, nprec, nsucs, flag, parents=npare, |
|
1231 | 1231 | date=date, metadata=localmetadata) |
|
1232 | 1232 | repo.filteredrevcache.clear() |
@@ -1250,7 +1250,7 def isenabled(repo, option): | |||
|
1250 | 1250 | # createmarkers must be enabled if other options are enabled |
|
1251 | 1251 | if ((allowunstableopt in result or exchangeopt in result) and |
|
1252 | 1252 | not createmarkersopt in result): |
|
1253 |
raise |
|
|
1253 | raise error.Abort(_("'createmarkers' obsolete option must be enabled " | |
|
1254 | 1254 | "if other obsolete options are enabled")) |
|
1255 | 1255 | |
|
1256 | 1256 | return option in result |
@@ -1056,7 +1056,7 the hunk is left unchanged. | |||
|
1056 | 1056 | elif r == 6: # all |
|
1057 | 1057 | ret = skipall = True |
|
1058 | 1058 | elif r == 7: # quit |
|
1059 |
raise |
|
|
1059 | raise error.Abort(_('user quit')) | |
|
1060 | 1060 | return ret, skipfile, skipall, newpatches |
|
1061 | 1061 | |
|
1062 | 1062 | seen = set() |
@@ -1964,7 +1964,7 def _applydiff(ui, fp, patcher, backend, | |||
|
1964 | 1964 | else: |
|
1965 | 1965 | store.setfile(path, data, mode) |
|
1966 | 1966 | else: |
|
1967 |
raise |
|
|
1967 | raise error.Abort(_('unsupported parser state: %s') % state) | |
|
1968 | 1968 | |
|
1969 | 1969 | if current_file: |
|
1970 | 1970 | rejects += current_file.close() |
@@ -2022,7 +2022,7 def patchbackend(ui, backend, patchobj, | |||
|
2022 | 2022 | if eolmode is None: |
|
2023 | 2023 | eolmode = ui.config('patch', 'eol', 'strict') |
|
2024 | 2024 | if eolmode.lower() not in eolmodes: |
|
2025 |
raise |
|
|
2025 | raise error.Abort(_('unsupported line endings type: %s') % eolmode) | |
|
2026 | 2026 | eolmode = eolmode.lower() |
|
2027 | 2027 | |
|
2028 | 2028 | store = filestore() |
@@ -2095,7 +2095,7 def changedfiles(ui, repo, patchpath, st | |||
|
2095 | 2095 | if gp.op == 'RENAME': |
|
2096 | 2096 | changed.add(gp.oldpath) |
|
2097 | 2097 | elif state not in ('hunk', 'git'): |
|
2098 |
raise |
|
|
2098 | raise error.Abort(_('unsupported parser state: %s') % state) | |
|
2099 | 2099 | return changed |
|
2100 | 2100 | finally: |
|
2101 | 2101 | fp.close() |
@@ -8,6 +8,7 import stat | |||
|
8 | 8 | from .i18n import _ |
|
9 | 9 | from . import ( |
|
10 | 10 | encoding, |
|
11 | error, | |
|
11 | 12 | util, |
|
12 | 13 | ) |
|
13 | 14 | |
@@ -47,18 +48,18 class pathauditor(object): | |||
|
47 | 48 | return |
|
48 | 49 | # AIX ignores "/" at end of path, others raise EISDIR. |
|
49 | 50 | if util.endswithsep(path): |
|
50 |
raise |
|
|
51 | raise error.Abort(_("path ends in directory separator: %s") % path) | |
|
51 | 52 | parts = util.splitpath(path) |
|
52 | 53 | if (os.path.splitdrive(path)[0] |
|
53 | 54 | or _lowerclean(parts[0]) in ('.hg', '.hg.', '') |
|
54 | 55 | or os.pardir in parts): |
|
55 |
raise |
|
|
56 | raise error.Abort(_("path contains illegal component: %s") % path) | |
|
56 | 57 | # Windows shortname aliases |
|
57 | 58 | for p in parts: |
|
58 | 59 | if "~" in p: |
|
59 | 60 | first, last = p.split("~", 1) |
|
60 | 61 | if last.isdigit() and first.upper() in ["HG", "HG8B6C"]: |
|
61 |
raise |
|
|
62 | raise error.Abort(_("path contains illegal component: %s") | |
|
62 | 63 | % path) |
|
63 | 64 | if '.hg' in _lowerclean(path): |
|
64 | 65 | lparts = [_lowerclean(p.lower()) for p in parts] |
@@ -66,7 +67,7 class pathauditor(object): | |||
|
66 | 67 | if p in lparts[1:]: |
|
67 | 68 | pos = lparts.index(p) |
|
68 | 69 | base = os.path.join(*parts[:pos]) |
|
69 |
raise |
|
|
70 | raise error.Abort(_("path '%s' is inside nested repo %r") | |
|
70 | 71 | % (path, base)) |
|
71 | 72 | |
|
72 | 73 | normparts = util.splitpath(normpath) |
@@ -90,13 +91,13 class pathauditor(object): | |||
|
90 | 91 | raise |
|
91 | 92 | else: |
|
92 | 93 | if stat.S_ISLNK(st.st_mode): |
|
93 |
raise |
|
|
94 | raise error.Abort( | |
|
94 | 95 | _('path %r traverses symbolic link %r') |
|
95 | 96 | % (path, prefix)) |
|
96 | 97 | elif (stat.S_ISDIR(st.st_mode) and |
|
97 | 98 | os.path.isdir(os.path.join(curpath, '.hg'))): |
|
98 | 99 | if not self.callback or not self.callback(curpath): |
|
99 |
raise |
|
|
100 | raise error.Abort(_("path '%s' is inside nested " | |
|
100 | 101 | "repo %r") |
|
101 | 102 | % (path, prefix)) |
|
102 | 103 | prefixes.append(normprefix) |
@@ -112,7 +113,7 class pathauditor(object): | |||
|
112 | 113 | try: |
|
113 | 114 | self(path) |
|
114 | 115 | return True |
|
115 |
except (OSError, |
|
|
116 | except (OSError, error.Abort): | |
|
116 | 117 | return False |
|
117 | 118 | |
|
118 | 119 | def canonpath(root, cwd, myname, auditor=None): |
@@ -167,10 +168,10 def canonpath(root, cwd, myname, auditor | |||
|
167 | 168 | canonpath(root, root, myname, auditor) |
|
168 | 169 | hint = (_("consider using '--cwd %s'") |
|
169 | 170 | % os.path.relpath(root, cwd)) |
|
170 |
except |
|
|
171 | except error.Abort: | |
|
171 | 172 | pass |
|
172 | 173 | |
|
173 |
raise |
|
|
174 | raise error.Abort(_("%s not under root '%s'") % (myname, root), | |
|
174 | 175 | hint=hint) |
|
175 | 176 | |
|
176 | 177 | def normasprefix(path): |
@@ -115,7 +115,6 from .node import ( | |||
|
115 | 115 | ) |
|
116 | 116 | from . import ( |
|
117 | 117 | error, |
|
118 | util, | |
|
119 | 118 | ) |
|
120 | 119 | |
|
121 | 120 | allphases = public, draft, secret = range(3) |
@@ -306,7 +305,7 class phasecache(object): | |||
|
306 | 305 | if self.phase(repo, repo[n].rev()) < targetphase] |
|
307 | 306 | if newroots: |
|
308 | 307 | if nullid in newroots: |
|
309 |
raise |
|
|
308 | raise error.Abort(_('cannot change null revision phase')) | |
|
310 | 309 | currentroots = currentroots.copy() |
|
311 | 310 | currentroots.update(newroots) |
|
312 | 311 | ctxs = repo.set('roots(%ln::)', currentroots) |
@@ -15,6 +15,7 from .node import short | |||
|
15 | 15 | from . import ( |
|
16 | 16 | bundle2, |
|
17 | 17 | changegroup, |
|
18 | error, | |
|
18 | 19 | exchange, |
|
19 | 20 | util, |
|
20 | 21 | ) |
@@ -156,7 +157,7 def strip(ui, repo, nodelist, backup=Tru | |||
|
156 | 157 | if curtr is not None: |
|
157 | 158 | del curtr # avoid carrying reference to transaction for nothing |
|
158 | 159 | msg = _('programming error: cannot strip from inside a transaction') |
|
159 |
raise |
|
|
160 | raise error.Abort(msg, hint=_('contact your extension maintainer')) | |
|
160 | 161 | |
|
161 | 162 | tr = repo.transaction("strip") |
|
162 | 163 | offset = len(tr.entries) |
@@ -480,11 +480,11 def _mergedefaultdest(repo, subset, x): | |||
|
480 | 480 | else: |
|
481 | 481 | node = bmheads[0] |
|
482 | 482 | elif len(bmheads) > 2: |
|
483 |
raise |
|
|
483 | raise error.Abort(_("multiple matching bookmarks to merge - " | |
|
484 | 484 | "please merge with an explicit rev or bookmark"), |
|
485 | 485 | hint=_("run 'hg heads' to see all heads")) |
|
486 | 486 | elif len(bmheads) <= 1: |
|
487 |
raise |
|
|
487 | raise error.Abort(_("no matching bookmark to merge - " | |
|
488 | 488 | "please merge with an explicit rev or bookmark"), |
|
489 | 489 | hint=_("run 'hg heads' to see all heads")) |
|
490 | 490 | else: |
@@ -493,7 +493,7 def _mergedefaultdest(repo, subset, x): | |||
|
493 | 493 | nbhs = [bh for bh in bheads if not repo[bh].bookmarks()] |
|
494 | 494 | |
|
495 | 495 | if len(nbhs) > 2: |
|
496 |
raise |
|
|
496 | raise error.Abort(_("branch '%s' has %d heads - " | |
|
497 | 497 | "please merge with an explicit rev") |
|
498 | 498 | % (branch, len(bheads)), |
|
499 | 499 | hint=_("run 'hg heads .' to see heads")) |
@@ -501,21 +501,21 def _mergedefaultdest(repo, subset, x): | |||
|
501 | 501 | parent = repo.dirstate.p1() |
|
502 | 502 | if len(nbhs) <= 1: |
|
503 | 503 | if len(bheads) > 1: |
|
504 |
raise |
|
|
504 | raise error.Abort(_("heads are bookmarked - " | |
|
505 | 505 | "please merge with an explicit rev"), |
|
506 | 506 | hint=_("run 'hg heads' to see all heads")) |
|
507 | 507 | if len(repo.heads()) > 1: |
|
508 |
raise |
|
|
508 | raise error.Abort(_("branch '%s' has one head - " | |
|
509 | 509 | "please merge with an explicit rev") |
|
510 | 510 | % branch, |
|
511 | 511 | hint=_("run 'hg heads' to see all heads")) |
|
512 | 512 | msg, hint = _('nothing to merge'), None |
|
513 | 513 | if parent != repo.lookup(branch): |
|
514 | 514 | hint = _("use 'hg update' instead") |
|
515 |
raise |
|
|
515 | raise error.Abort(msg, hint=hint) | |
|
516 | 516 | |
|
517 | 517 | if parent not in bheads: |
|
518 |
raise |
|
|
518 | raise error.Abort(_('working directory not at a head revision'), | |
|
519 | 519 | hint=_("use 'hg update' or merge with an " |
|
520 | 520 | "explicit revision")) |
|
521 | 521 | if parent == nbhs[0]: |
@@ -721,7 +721,7 def bundle(repo, subset, x): | |||
|
721 | 721 | try: |
|
722 | 722 | bundlerevs = repo.changelog.bundlerevs |
|
723 | 723 | except AttributeError: |
|
724 |
raise |
|
|
724 | raise error.Abort(_("no bundle provided - specify with -R")) | |
|
725 | 725 | return subset & bundlerevs |
|
726 | 726 | |
|
727 | 727 | def checkstatus(repo, subset, pat, field): |
@@ -2669,7 +2669,7 def _expandaliases(aliases, tree, expand | |||
|
2669 | 2669 | alias = _getalias(aliases, tree) |
|
2670 | 2670 | if alias is not None: |
|
2671 | 2671 | if alias.error: |
|
2672 |
raise |
|
|
2672 | raise error.Abort(alias.error) | |
|
2673 | 2673 | if alias in expanding: |
|
2674 | 2674 | raise error.ParseError(_('infinite expansion of revset alias "%s" ' |
|
2675 | 2675 | 'detected') % alias.name) |
@@ -2868,7 +2868,7 def formatspec(expr, *args): | |||
|
2868 | 2868 | ret += listexp(list(args[arg]), d) |
|
2869 | 2869 | arg += 1 |
|
2870 | 2870 | else: |
|
2871 |
raise |
|
|
2871 | raise error.Abort('unexpected revspec format character %s' % d) | |
|
2872 | 2872 | else: |
|
2873 | 2873 | ret += c |
|
2874 | 2874 | pos += 1 |
@@ -123,20 +123,20 def checknewlabel(repo, lbl, kind): | |||
|
123 | 123 | # Do not use the "kind" parameter in ui output. |
|
124 | 124 | # It makes strings difficult to translate. |
|
125 | 125 | if lbl in ['tip', '.', 'null']: |
|
126 |
raise |
|
|
126 | raise error.Abort(_("the name '%s' is reserved") % lbl) | |
|
127 | 127 | for c in (':', '\0', '\n', '\r'): |
|
128 | 128 | if c in lbl: |
|
129 |
raise |
|
|
129 | raise error.Abort(_("%r cannot be used in a name") % c) | |
|
130 | 130 | try: |
|
131 | 131 | int(lbl) |
|
132 |
raise |
|
|
132 | raise error.Abort(_("cannot use an integer as a name")) | |
|
133 | 133 | except ValueError: |
|
134 | 134 | pass |
|
135 | 135 | |
|
136 | 136 | def checkfilename(f): |
|
137 | 137 | '''Check that the filename f is an acceptable filename for a tracked file''' |
|
138 | 138 | if '\r' in f or '\n' in f: |
|
139 |
raise |
|
|
139 | raise error.Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f) | |
|
140 | 140 | |
|
141 | 141 | def checkportable(ui, f): |
|
142 | 142 | '''Check if filename f is portable and warn or abort depending on config''' |
@@ -147,7 +147,7 def checkportable(ui, f): | |||
|
147 | 147 | if msg: |
|
148 | 148 | msg = "%s: %r" % (msg, f) |
|
149 | 149 | if abort: |
|
150 |
raise |
|
|
150 | raise error.Abort(msg) | |
|
151 | 151 | ui.warn(_("warning: %s\n") % msg) |
|
152 | 152 | |
|
153 | 153 | def checkportabilityalert(ui): |
@@ -182,7 +182,7 class casecollisionauditor(object): | |||
|
182 | 182 | if fl in self._loweredfiles and f not in self._dirstate: |
|
183 | 183 | msg = _('possible case-folding collision for %s') % f |
|
184 | 184 | if self._abort: |
|
185 |
raise |
|
|
185 | raise error.Abort(msg) | |
|
186 | 186 | self._ui.warn(_("warning: %s\n") % msg) |
|
187 | 187 | self._loweredfiles.add(fl) |
|
188 | 188 | self._newfiles.add(f) |
@@ -475,7 +475,7 class vfs(abstractvfs): | |||
|
475 | 475 | if self._audit: |
|
476 | 476 | r = util.checkosfilename(path) |
|
477 | 477 | if r: |
|
478 |
raise |
|
|
478 | raise error.Abort("%s: %r" % (r, path)) | |
|
479 | 479 | self.audit(path) |
|
480 | 480 | f = self.join(path) |
|
481 | 481 | |
@@ -583,7 +583,7 class readonlyvfs(abstractvfs, auditvfs) | |||
|
583 | 583 | |
|
584 | 584 | def __call__(self, path, mode='r', *args, **kw): |
|
585 | 585 | if mode not in ('r', 'rb'): |
|
586 |
raise |
|
|
586 | raise error.Abort('this vfs is read only') | |
|
587 | 587 | return self.vfs(path, mode, *args, **kw) |
|
588 | 588 | |
|
589 | 589 | def join(self, path, *insidef): |
@@ -689,7 +689,7 def revsingle(repo, revspec, default='.' | |||
|
689 | 689 | |
|
690 | 690 | l = revrange(repo, [revspec]) |
|
691 | 691 | if not l: |
|
692 |
raise |
|
|
692 | raise error.Abort(_('empty revision set')) | |
|
693 | 693 | return repo[l.last()] |
|
694 | 694 | |
|
695 | 695 | def _pairspec(revspec): |
@@ -716,7 +716,7 def revpair(repo, revs): | |||
|
716 | 716 | second = l.last() |
|
717 | 717 | |
|
718 | 718 | if first is None: |
|
719 |
raise |
|
|
719 | raise error.Abort(_('empty revision range')) | |
|
720 | 720 | |
|
721 | 721 | # if top-level is range expression, the result must always be a pair |
|
722 | 722 | if first == second and len(revs) == 1 and not _pairspec(revs[0]): |
@@ -52,7 +52,7 from .node import ( | |||
|
52 | 52 | ) |
|
53 | 53 | from . import ( |
|
54 | 54 | dagutil, |
|
55 | util, | |
|
55 | error, | |
|
56 | 56 | ) |
|
57 | 57 | |
|
58 | 58 | def _updatesample(dag, nodes, sample, quicksamplesize=0): |
@@ -241,7 +241,7 def findcommonheads(ui, local, remote, | |||
|
241 | 241 | |
|
242 | 242 | if not result and srvheadhashes != [nullid]: |
|
243 | 243 | if abortwhenunrelated: |
|
244 |
raise |
|
|
244 | raise error.Abort(_("repository is unrelated")) | |
|
245 | 245 | else: |
|
246 | 246 | ui.warn(_("warning: repository is unrelated\n")) |
|
247 | 247 | return (set([nullid]), True, srvheadhashes,) |
@@ -23,6 +23,7 import sys | |||
|
23 | 23 | |
|
24 | 24 | from .i18n import _ |
|
25 | 25 | from . import ( |
|
26 | error, | |
|
26 | 27 | mdiff, |
|
27 | 28 | scmutil, |
|
28 | 29 | util, |
@@ -361,7 +362,7 def simplemerge(ui, local, base, other, | |||
|
361 | 362 | if not opts.get('quiet'): |
|
362 | 363 | ui.warn(_('warning: %s\n') % msg) |
|
363 | 364 | if not opts.get('text'): |
|
364 |
raise |
|
|
365 | raise error.Abort(msg) | |
|
365 | 366 | return text |
|
366 | 367 | |
|
367 | 368 | mode = opts.get('mode','merge') |
@@ -381,13 +382,13 def simplemerge(ui, local, base, other, | |||
|
381 | 382 | if len(labels) > 2: |
|
382 | 383 | name_base = labels[2] |
|
383 | 384 | if len(labels) > 3: |
|
384 |
raise |
|
|
385 | raise error.Abort(_("can only specify three labels.")) | |
|
385 | 386 | |
|
386 | 387 | try: |
|
387 | 388 | localtext = readfile(local) |
|
388 | 389 | basetext = readfile(base) |
|
389 | 390 | othertext = readfile(other) |
|
390 |
except |
|
|
391 | except error.Abort: | |
|
391 | 392 | return 1 |
|
392 | 393 | |
|
393 | 394 | local = os.path.realpath(local) |
@@ -277,7 +277,7 class sshpeer(wireproto.wirepeer): | |||
|
277 | 277 | r = self._call(cmd, **args) |
|
278 | 278 | if r: |
|
279 | 279 | # XXX needs to be made better |
|
280 |
raise |
|
|
280 | raise error.Abort('unexpected remote reply: %s' % r) | |
|
281 | 281 | while True: |
|
282 | 282 | d = fp.read(4096) |
|
283 | 283 | if not d: |
@@ -12,6 +12,7 import os | |||
|
12 | 12 | import sys |
|
13 | 13 | |
|
14 | 14 | from . import ( |
|
15 | error, | |
|
15 | 16 | hook, |
|
16 | 17 | util, |
|
17 | 18 | wireproto, |
@@ -39,7 +40,7 class sshserver(wireproto.abstractserver | |||
|
39 | 40 | argline = self.fin.readline()[:-1] |
|
40 | 41 | arg, l = argline.split() |
|
41 | 42 | if arg not in keys: |
|
42 |
raise |
|
|
43 | raise error.Abort("unexpected parameter %r" % arg) | |
|
43 | 44 | if arg == '*': |
|
44 | 45 | star = {} |
|
45 | 46 | for k in xrange(int(l)): |
@@ -14,7 +14,7 import ssl | |||
|
14 | 14 | import sys |
|
15 | 15 | |
|
16 | 16 | from .i18n import _ |
|
17 | from . import util | |
|
17 | from . import error, util | |
|
18 | 18 | |
|
19 | 19 | _canloaddefaultcerts = False |
|
20 | 20 | try: |
@@ -50,7 +50,7 try: | |||
|
50 | 50 | # closed |
|
51 | 51 | # - see http://bugs.python.org/issue13721 |
|
52 | 52 | if not sslsocket.cipher(): |
|
53 |
raise |
|
|
53 | raise error.Abort(_('ssl connection failed')) | |
|
54 | 54 | return sslsocket |
|
55 | 55 | except AttributeError: |
|
56 | 56 | def wrapsocket(sock, keyfile, certfile, ui, cert_reqs=ssl.CERT_NONE, |
@@ -62,7 +62,7 except AttributeError: | |||
|
62 | 62 | # closed |
|
63 | 63 | # - see http://bugs.python.org/issue13721 |
|
64 | 64 | if not sslsocket.cipher(): |
|
65 |
raise |
|
|
65 | raise error.Abort(_('ssl connection failed')) | |
|
66 | 66 | return sslsocket |
|
67 | 67 | |
|
68 | 68 | def _verifycert(cert, hostname): |
@@ -140,7 +140,7 def sslkwargs(ui, host): | |||
|
140 | 140 | elif cacerts: |
|
141 | 141 | cacerts = util.expandpath(cacerts) |
|
142 | 142 | if not os.path.exists(cacerts): |
|
143 |
raise |
|
|
143 | raise error.Abort(_('could not find web.cacerts: %s') % cacerts) | |
|
144 | 144 | else: |
|
145 | 145 | cacerts = _defaultcacerts() |
|
146 | 146 | if cacerts and cacerts != '!': |
@@ -163,15 +163,15 class validator(object): | |||
|
163 | 163 | hostfingerprint = self.ui.config('hostfingerprints', host) |
|
164 | 164 | |
|
165 | 165 | if not sock.cipher(): # work around http://bugs.python.org/issue13721 |
|
166 |
raise |
|
|
166 | raise error.Abort(_('%s ssl connection error') % host) | |
|
167 | 167 | try: |
|
168 | 168 | peercert = sock.getpeercert(True) |
|
169 | 169 | peercert2 = sock.getpeercert() |
|
170 | 170 | except AttributeError: |
|
171 |
raise |
|
|
171 | raise error.Abort(_('%s ssl connection error') % host) | |
|
172 | 172 | |
|
173 | 173 | if not peercert: |
|
174 |
raise |
|
|
174 | raise error.Abort(_('%s certificate error: ' | |
|
175 | 175 | 'no certificate received') % host) |
|
176 | 176 | peerfingerprint = util.sha1(peercert).hexdigest() |
|
177 | 177 | nicefingerprint = ":".join([peerfingerprint[x:x + 2] |
@@ -179,7 +179,7 class validator(object): | |||
|
179 | 179 | if hostfingerprint: |
|
180 | 180 | if peerfingerprint.lower() != \ |
|
181 | 181 | hostfingerprint.replace(':', '').lower(): |
|
182 |
raise |
|
|
182 | raise error.Abort(_('certificate for %s has unexpected ' | |
|
183 | 183 | 'fingerprint %s') % (host, nicefingerprint), |
|
184 | 184 | hint=_('check hostfingerprint configuration')) |
|
185 | 185 | self.ui.debug('%s certificate matched fingerprint %s\n' % |
@@ -187,13 +187,13 class validator(object): | |||
|
187 | 187 | elif cacerts != '!': |
|
188 | 188 | msg = _verifycert(peercert2, host) |
|
189 | 189 | if msg: |
|
190 |
raise |
|
|
190 | raise error.Abort(_('%s certificate error: %s') % (host, msg), | |
|
191 | 191 | hint=_('configure hostfingerprint %s or use ' |
|
192 | 192 | '--insecure to connect insecurely') % |
|
193 | 193 | nicefingerprint) |
|
194 | 194 | self.ui.debug('%s certificate successfully verified\n' % host) |
|
195 | 195 | elif strict: |
|
196 |
raise |
|
|
196 | raise error.Abort(_('%s certificate with fingerprint %s not ' | |
|
197 | 197 | 'verified') % (host, nicefingerprint), |
|
198 | 198 | hint=_('check hostfingerprints or web.cacerts ' |
|
199 | 199 | 'config setting')) |
@@ -171,9 +171,9 class statichttprepository(localrepo.loc | |||
|
171 | 171 | return statichttppeer(self) |
|
172 | 172 | |
|
173 | 173 | def lock(self, wait=True): |
|
174 |
raise |
|
|
174 | raise error.Abort(_('cannot lock static-http repository')) | |
|
175 | 175 | |
|
176 | 176 | def instance(ui, path, create): |
|
177 | 177 | if create: |
|
178 |
raise |
|
|
178 | raise error.Abort(_('cannot create new static-http repository')) | |
|
179 | 179 | return statichttprepository(ui, path[7:]) |
@@ -6,7 +6,7 | |||
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from i18n import _ |
|
9 | import scmutil, util, parsers | |
|
9 | import scmutil, util, parsers, error | |
|
10 | 10 | import os, stat, errno |
|
11 | 11 | |
|
12 | 12 | _sha = util.sha1 |
@@ -405,7 +405,7 class fncache(object): | |||
|
405 | 405 | for n, line in enumerate(fp): |
|
406 | 406 | if not line.rstrip('\n'): |
|
407 | 407 | t = _('invalid entry in fncache, line %s') % (n + 1) |
|
408 |
raise |
|
|
408 | raise error.Abort(t) | |
|
409 | 409 | fp.close() |
|
410 | 410 | |
|
411 | 411 | def write(self, tr): |
@@ -123,11 +123,11 def maybeperformlegacystreamclone(pullop | |||
|
123 | 123 | raise error.ResponseError( |
|
124 | 124 | _('unexpected response from remote server:'), l) |
|
125 | 125 | if resp == 1: |
|
126 |
raise |
|
|
126 | raise error.Abort(_('operation forbidden by server')) | |
|
127 | 127 | elif resp == 2: |
|
128 |
raise |
|
|
128 | raise error.Abort(_('locking the remote repository failed')) | |
|
129 | 129 | elif resp != 0: |
|
130 |
raise |
|
|
130 | raise error.Abort(_('the server sent an unknown error code')) | |
|
131 | 131 | |
|
132 | 132 | l = fp.readline() |
|
133 | 133 | try: |
@@ -95,7 +95,7 def state(ctx, ui): | |||
|
95 | 95 | return |
|
96 | 96 | p.parse(f, data, sections, remap, read) |
|
97 | 97 | else: |
|
98 |
raise |
|
|
98 | raise error.Abort(_("subrepo spec file \'%s\' not found") % | |
|
99 | 99 | repo.pathto(f)) |
|
100 | 100 | if '.hgsub' in ctx: |
|
101 | 101 | read('.hgsub') |
@@ -113,7 +113,7 def state(ctx, ui): | |||
|
113 | 113 | try: |
|
114 | 114 | revision, path = l.split(" ", 1) |
|
115 | 115 | except ValueError: |
|
116 |
raise |
|
|
116 | raise error.Abort(_("invalid subrepository revision " | |
|
117 | 117 | "specifier in \'%s\' line %d") |
|
118 | 118 | % (repo.pathto('.hgsubstate'), (i + 1))) |
|
119 | 119 | rev[path] = revision |
@@ -133,7 +133,7 def state(ctx, ui): | |||
|
133 | 133 | try: |
|
134 | 134 | src = re.sub(pattern, repl, src, 1) |
|
135 | 135 | except re.error as e: |
|
136 |
raise |
|
|
136 | raise error.Abort(_("bad subrepository pattern in %s: %s") | |
|
137 | 137 | % (p.source('subpaths', pattern), e)) |
|
138 | 138 | return src |
|
139 | 139 | |
@@ -142,7 +142,7 def state(ctx, ui): | |||
|
142 | 142 | kind = 'hg' |
|
143 | 143 | if src.startswith('['): |
|
144 | 144 | if ']' not in src: |
|
145 |
raise |
|
|
145 | raise error.Abort(_('missing ] in subrepo source')) | |
|
146 | 146 | kind, src = src.split(']', 1) |
|
147 | 147 | kind = kind[1:] |
|
148 | 148 | src = src.lstrip() # strip any extra whitespace after ']' |
@@ -324,7 +324,7 def _abssource(repo, push=False, abort=T | |||
|
324 | 324 | # chop off the .hg component to get the default path form |
|
325 | 325 | return os.path.dirname(repo.sharedpath) |
|
326 | 326 | if abort: |
|
327 |
raise |
|
|
327 | raise error.Abort(_("default path for subrepository not found")) | |
|
328 | 328 | |
|
329 | 329 | def _sanitize(ui, vfs, ignore): |
|
330 | 330 | for dirname, dirs, names in vfs.walk(): |
@@ -353,7 +353,7 def subrepo(ctx, path, allowwdir=False): | |||
|
353 | 353 | pathutil.pathauditor(ctx.repo().root)(path) |
|
354 | 354 | state = ctx.substate[path] |
|
355 | 355 | if state[2] not in types: |
|
356 |
raise |
|
|
356 | raise error.Abort(_('unknown subrepo type %s') % state[2]) | |
|
357 | 357 | if allowwdir: |
|
358 | 358 | state = (state[0], ctx.subrev(path), state[2]) |
|
359 | 359 | return types[state[2]](ctx, path, state[:2]) |
@@ -371,7 +371,7 def nullsubrepo(ctx, path, pctx): | |||
|
371 | 371 | pathutil.pathauditor(ctx.repo().root)(path) |
|
372 | 372 | state = ctx.substate[path] |
|
373 | 373 | if state[2] not in types: |
|
374 |
raise |
|
|
374 | raise error.Abort(_('unknown subrepo type %s') % state[2]) | |
|
375 | 375 | subrev = '' |
|
376 | 376 | if state[2] == 'hg': |
|
377 | 377 | subrev = "0" * 40 |
@@ -384,7 +384,7 def newcommitphase(ui, ctx): | |||
|
384 | 384 | return commitphase |
|
385 | 385 | check = ui.config('phases', 'checksubrepos', 'follow') |
|
386 | 386 | if check not in ('ignore', 'follow', 'abort'): |
|
387 |
raise |
|
|
387 | raise error.Abort(_('invalid phases.checksubrepos configuration: %s') | |
|
388 | 388 | % (check)) |
|
389 | 389 | if check == 'ignore': |
|
390 | 390 | return commitphase |
@@ -398,7 +398,7 def newcommitphase(ui, ctx): | |||
|
398 | 398 | maxsub = s |
|
399 | 399 | if commitphase < maxphase: |
|
400 | 400 | if check == 'abort': |
|
401 |
raise |
|
|
401 | raise error.Abort(_("can't commit in %s phase" | |
|
402 | 402 | " conflicting %s from subrepository %s") % |
|
403 | 403 | (phases.phasenames[commitphase], |
|
404 | 404 | phases.phasenames[maxphase], maxsub)) |
@@ -456,7 +456,7 class abstractsubrepo(object): | |||
|
456 | 456 | """ |
|
457 | 457 | dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate) |
|
458 | 458 | if dirtyreason: |
|
459 |
raise |
|
|
459 | raise error.Abort(dirtyreason) | |
|
460 | 460 | |
|
461 | 461 | def basestate(self): |
|
462 | 462 | """current working directory base state, disregarding .hgsubstate |
@@ -1073,7 +1073,7 class svnsubrepo(abstractsubrepo): | |||
|
1073 | 1073 | self._state = state |
|
1074 | 1074 | self._exe = util.findexe('svn') |
|
1075 | 1075 | if not self._exe: |
|
1076 |
raise |
|
|
1076 | raise error.Abort(_("'svn' executable not found for subrepo '%s'") | |
|
1077 | 1077 | % self._path) |
|
1078 | 1078 | |
|
1079 | 1079 | def _svncommand(self, commands, filename='', failok=False): |
@@ -1108,7 +1108,8 class svnsubrepo(abstractsubrepo): | |||
|
1108 | 1108 | stderr = stderr.strip() |
|
1109 | 1109 | if not failok: |
|
1110 | 1110 | if p.returncode: |
|
1111 |
raise |
|
|
1111 | raise error.Abort(stderr or 'exited with code %d' | |
|
1112 | % p.returncode) | |
|
1112 | 1113 | if stderr: |
|
1113 | 1114 | self.ui.warn(stderr + '\n') |
|
1114 | 1115 | return stdout, stderr |
@@ -1118,7 +1119,7 class svnsubrepo(abstractsubrepo): | |||
|
1118 | 1119 | output, err = self._svncommand(['--version', '--quiet'], filename=None) |
|
1119 | 1120 | m = re.search(r'^(\d+)\.(\d+)', output) |
|
1120 | 1121 | if not m: |
|
1121 |
raise |
|
|
1122 | raise error.Abort(_('cannot retrieve svn tool version')) | |
|
1122 | 1123 | return (int(m.group(1)), int(m.group(2))) |
|
1123 | 1124 | |
|
1124 | 1125 | def _wcrevs(self): |
@@ -1196,11 +1197,11 class svnsubrepo(abstractsubrepo): | |||
|
1196 | 1197 | return self.basestate() |
|
1197 | 1198 | if extchanged: |
|
1198 | 1199 | # Do not try to commit externals |
|
1199 |
raise |
|
|
1200 | raise error.Abort(_('cannot commit svn externals')) | |
|
1200 | 1201 | if missing: |
|
1201 | 1202 | # svn can commit with missing entries but aborting like hg |
|
1202 | 1203 | # seems a better approach. |
|
1203 |
raise |
|
|
1204 | raise error.Abort(_('cannot commit missing svn entries')) | |
|
1204 | 1205 | commitinfo, err = self._svncommand(['commit', '-m', text]) |
|
1205 | 1206 | self.ui.status(commitinfo) |
|
1206 | 1207 | newrev = re.search('Committed revision ([0-9]+).', commitinfo) |
@@ -1210,8 +1211,8 class svnsubrepo(abstractsubrepo): | |||
|
1210 | 1211 | # svn one. For instance, svn ignores missing files |
|
1211 | 1212 | # when committing. If there are only missing files, no |
|
1212 | 1213 | # commit is made, no output and no error code. |
|
1213 |
raise |
|
|
1214 |
raise |
|
|
1214 | raise error.Abort(_('failed to commit svn changes')) | |
|
1215 | raise error.Abort(commitinfo.splitlines()[-1]) | |
|
1215 | 1216 | newrev = newrev.groups()[0] |
|
1216 | 1217 | self.ui.status(self._svncommand(['update', '-r', newrev])[0]) |
|
1217 | 1218 | return newrev |
@@ -1250,7 +1251,7 class svnsubrepo(abstractsubrepo): | |||
|
1250 | 1251 | self.remove() |
|
1251 | 1252 | self.get(state, overwrite=False) |
|
1252 | 1253 | return |
|
1253 |
raise |
|
|
1254 | raise error.Abort((status or err).splitlines()[-1]) | |
|
1254 | 1255 | self.ui.status(status) |
|
1255 | 1256 | |
|
1256 | 1257 | @annotatesubrepoerror |
@@ -1307,7 +1308,7 class gitsubrepo(abstractsubrepo): | |||
|
1307 | 1308 | if versionstatus == 'unknown': |
|
1308 | 1309 | self.ui.warn(_('cannot retrieve git version\n')) |
|
1309 | 1310 | elif versionstatus == 'abort': |
|
1310 |
raise |
|
|
1311 | raise error.Abort(_('git subrepo requires at least 1.6.0 or later')) | |
|
1311 | 1312 | elif versionstatus == 'warning': |
|
1312 | 1313 | self.ui.warn(_('git subrepo requires at least 1.6.0 or later\n')) |
|
1313 | 1314 | |
@@ -1394,7 +1395,7 class gitsubrepo(abstractsubrepo): | |||
|
1394 | 1395 | if command in ('cat-file', 'symbolic-ref'): |
|
1395 | 1396 | return retdata, p.returncode |
|
1396 | 1397 | # for all others, abort |
|
1397 |
raise |
|
|
1398 | raise error.Abort('git %s error %d in %s' % | |
|
1398 | 1399 | (command, p.returncode, self._relpath)) |
|
1399 | 1400 | |
|
1400 | 1401 | return retdata, p.returncode |
@@ -1491,7 +1492,7 class gitsubrepo(abstractsubrepo): | |||
|
1491 | 1492 | # try only origin: the originally cloned repo |
|
1492 | 1493 | self._gitcommand(['fetch']) |
|
1493 | 1494 | if not self._githavelocally(revision): |
|
1494 |
raise |
|
|
1495 | raise error.Abort(_("revision %s does not exist in subrepo %s\n") % | |
|
1495 | 1496 | (revision, self._relpath)) |
|
1496 | 1497 | |
|
1497 | 1498 | @annotatesubrepoerror |
@@ -1600,7 +1601,7 class gitsubrepo(abstractsubrepo): | |||
|
1600 | 1601 | @annotatesubrepoerror |
|
1601 | 1602 | def commit(self, text, user, date): |
|
1602 | 1603 | if self._gitmissing(): |
|
1603 |
raise |
|
|
1604 | raise error.Abort(_("subrepo %s is missing") % self._relpath) | |
|
1604 | 1605 | cmd = ['commit', '-a', '-m', text] |
|
1605 | 1606 | env = os.environ.copy() |
|
1606 | 1607 | if user: |
@@ -1646,7 +1647,7 class gitsubrepo(abstractsubrepo): | |||
|
1646 | 1647 | if not self._state[1]: |
|
1647 | 1648 | return True |
|
1648 | 1649 | if self._gitmissing(): |
|
1649 |
raise |
|
|
1650 | raise error.Abort(_("subrepo %s is missing") % self._relpath) | |
|
1650 | 1651 | # if a branch in origin contains the revision, nothing to do |
|
1651 | 1652 | branch2rev, rev2branch = self._gitbranchmap() |
|
1652 | 1653 | if self._state[1] in rev2branch: |
@@ -270,7 +270,7 def runfilter(context, mapping, data): | |||
|
270 | 270 | dt = arg[1][1] |
|
271 | 271 | else: |
|
272 | 272 | dt = arg[1] |
|
273 |
raise |
|
|
273 | raise error.Abort(_("template filter '%s' is not compatible with " | |
|
274 | 274 | "keyword '%s'") % (filt.func_name, dt)) |
|
275 | 275 | |
|
276 | 276 | def buildmap(exp, context): |
@@ -840,7 +840,7 def stylelist(): | |||
|
840 | 840 | stylelist.append(split[1]) |
|
841 | 841 | return ", ".join(sorted(stylelist)) |
|
842 | 842 | |
|
843 |
class TemplateNotFound( |
|
|
843 | class TemplateNotFound(error.Abort): | |
|
844 | 844 | pass |
|
845 | 845 | |
|
846 | 846 | class templater(object): |
@@ -873,7 +873,7 class templater(object): | |||
|
873 | 873 | if not mapfile: |
|
874 | 874 | return |
|
875 | 875 | if not os.path.exists(mapfile): |
|
876 |
raise |
|
|
876 | raise error.Abort(_("style '%s' not found") % mapfile, | |
|
877 | 877 | hint=_("available styles: %s") % stylelist()) |
|
878 | 878 | |
|
879 | 879 | conf = config.config(includepaths=templatepaths()) |
@@ -71,7 +71,7 def _playback(journal, report, opener, v | |||
|
71 | 71 | except (IOError, OSError) as inst: |
|
72 | 72 | if inst.errno != errno.ENOENT: |
|
73 | 73 | raise |
|
74 |
except (IOError, OSError, |
|
|
74 | except (IOError, OSError, error.Abort) as inst: | |
|
75 | 75 | if not c: |
|
76 | 76 | raise |
|
77 | 77 | |
@@ -83,7 +83,7 def _playback(journal, report, opener, v | |||
|
83 | 83 | for f in backupfiles: |
|
84 | 84 | if opener.exists(f): |
|
85 | 85 | opener.unlink(f) |
|
86 |
except (IOError, OSError, |
|
|
86 | except (IOError, OSError, error.Abort) as inst: | |
|
87 | 87 | # only pure backup file remains, it is sage to ignore any error |
|
88 | 88 | pass |
|
89 | 89 | |
@@ -417,7 +417,7 class transaction(object): | |||
|
417 | 417 | if not f and b and vfs.exists(b): |
|
418 | 418 | try: |
|
419 | 419 | vfs.unlink(b) |
|
420 |
except (IOError, OSError, |
|
|
420 | except (IOError, OSError, error.Abort) as inst: | |
|
421 | 421 | if not c: |
|
422 | 422 | raise |
|
423 | 423 | # Abort may be raise by read only opener |
@@ -440,7 +440,7 class transaction(object): | |||
|
440 | 440 | if b and vfs.exists(b): |
|
441 | 441 | try: |
|
442 | 442 | vfs.unlink(b) |
|
443 |
except (IOError, OSError, |
|
|
443 | except (IOError, OSError, error.Abort) as inst: | |
|
444 | 444 | if not c: |
|
445 | 445 | raise |
|
446 | 446 | # Abort may be raise by read only opener |
@@ -16,7 +16,6 from .node import ( | |||
|
16 | 16 | ) |
|
17 | 17 | from . import ( |
|
18 | 18 | error, |
|
19 | util, | |
|
20 | 19 | ) |
|
21 | 20 | |
|
22 | 21 | def findcommonincoming(repo, remote, heads=None, force=False): |
@@ -149,7 +148,7 def findcommonincoming(repo, remote, hea | |||
|
149 | 148 | if force: |
|
150 | 149 | repo.ui.warn(_("warning: repository is unrelated\n")) |
|
151 | 150 | else: |
|
152 |
raise |
|
|
151 | raise error.Abort(_("repository is unrelated")) | |
|
153 | 152 | |
|
154 | 153 | repo.ui.debug("found new changesets starting at " + |
|
155 | 154 | " ".join([short(f) for f in fetch]) + "\n") |
@@ -535,11 +535,12 class ui(object): | |||
|
535 | 535 | except KeyError: |
|
536 | 536 | pass |
|
537 | 537 | if not user: |
|
538 |
raise |
|
|
538 | raise error.Abort(_('no username supplied'), | |
|
539 | 539 | hint=_('use "hg config --edit" ' |
|
540 | 540 | 'to set your username')) |
|
541 | 541 | if "\n" in user: |
|
542 |
raise |
|
|
542 | raise error.Abort(_("username %s contains a newline\n") | |
|
543 | % repr(user)) | |
|
543 | 544 | return user |
|
544 | 545 | |
|
545 | 546 | def shortuser(self, user): |
@@ -755,7 +756,7 class ui(object): | |||
|
755 | 756 | self.write(r, "\n") |
|
756 | 757 | return r |
|
757 | 758 | except EOFError: |
|
758 |
raise |
|
|
759 | raise error.Abort(_('response expected')) | |
|
759 | 760 | |
|
760 | 761 | @staticmethod |
|
761 | 762 | def extractchoices(prompt): |
@@ -802,7 +803,7 class ui(object): | |||
|
802 | 803 | else: |
|
803 | 804 | return getpass.getpass('') |
|
804 | 805 | except EOFError: |
|
805 |
raise |
|
|
806 | raise error.Abort(_('response expected')) | |
|
806 | 807 | def status(self, *msg, **opts): |
|
807 | 808 | '''write status message to output (if ui.quiet is False) |
|
808 | 809 | |
@@ -858,7 +859,7 class ui(object): | |||
|
858 | 859 | |
|
859 | 860 | self.system("%s \"%s\"" % (editor, name), |
|
860 | 861 | environ=environ, |
|
861 |
onerr= |
|
|
862 | onerr=error.Abort, errprefix=_("edit failed")) | |
|
862 | 863 | |
|
863 | 864 | f = open(name) |
|
864 | 865 | t = f.read() |
@@ -21,6 +21,7 from .node import nullid | |||
|
21 | 21 | from . import ( |
|
22 | 22 | changelog, |
|
23 | 23 | cmdutil, |
|
24 | error, | |
|
24 | 25 | filelog, |
|
25 | 26 | localrepo, |
|
26 | 27 | manifest, |
@@ -231,7 +232,7 class unionrepository(localrepo.localrep | |||
|
231 | 232 | |
|
232 | 233 | def instance(ui, path, create): |
|
233 | 234 | if create: |
|
234 |
raise |
|
|
235 | raise error.Abort(_('cannot create new union repository')) | |
|
235 | 236 | parentpath = ui.config("bundle", "mainreporoot", "") |
|
236 | 237 | if not parentpath: |
|
237 | 238 | # try to find the correct path to the working directory repo |
@@ -19,6 +19,7 import urllib2 | |||
|
19 | 19 | |
|
20 | 20 | from .i18n import _ |
|
21 | 21 | from . import ( |
|
22 | error, | |
|
22 | 23 | httpconnection as httpconnectionmod, |
|
23 | 24 | keepalive, |
|
24 | 25 | sslutil, |
@@ -48,7 +49,7 class passwordmgr(urllib2.HTTPPasswordMg | |||
|
48 | 49 | u = util.url(authuri) |
|
49 | 50 | u.query = None |
|
50 | 51 | if not self.ui.interactive(): |
|
51 |
raise |
|
|
52 | raise error.Abort(_('http authorization required for %s') % | |
|
52 | 53 | util.hidepassword(str(u))) |
|
53 | 54 | |
|
54 | 55 | self.ui.write(_("http authorization required for %s\n") % |
@@ -1925,7 +1925,7 def getport(port): | |||
|
1925 | 1925 | |
|
1926 | 1926 | If port is an integer, it's returned as is. If it's a string, it's |
|
1927 | 1927 | looked up using socket.getservbyname(). If there's no matching |
|
1928 |
service, |
|
|
1928 | service, error.Abort is raised. | |
|
1929 | 1929 | """ |
|
1930 | 1930 | try: |
|
1931 | 1931 | return int(port) |
@@ -50,7 +50,7 def _verify(repo): | |||
|
50 | 50 | lrugetctx = util.lrucachefunc(repo.changectx) |
|
51 | 51 | |
|
52 | 52 | if not repo.url().startswith('file:'): |
|
53 |
raise |
|
|
53 | raise error.Abort(_("cannot verify bundle or remote repos")) | |
|
54 | 54 | |
|
55 | 55 | def err(linkrev, msg, filename=None): |
|
56 | 56 | if linkrev is not None: |
@@ -690,7 +690,7 def pushkey(repo, proto, namespace, key, | |||
|
690 | 690 | try: |
|
691 | 691 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), |
|
692 | 692 | encoding.tolocal(old), new) or False |
|
693 |
except |
|
|
693 | except error.Abort: | |
|
694 | 694 | r = False |
|
695 | 695 | |
|
696 | 696 | output = proto.restore() |
@@ -752,12 +752,12 def unbundle(repo, proto, heads): | |||
|
752 | 752 | fp.close() |
|
753 | 753 | os.unlink(tempname) |
|
754 | 754 | |
|
755 |
except (error.BundleValueError, |
|
|
755 | except (error.BundleValueError, error.Abort, error.PushRaced) as exc: | |
|
756 | 756 | # handle non-bundle2 case first |
|
757 | 757 | if not getattr(exc, 'duringunbundle2', False): |
|
758 | 758 | try: |
|
759 | 759 | raise |
|
760 |
except |
|
|
760 | except error.Abort: | |
|
761 | 761 | # The old code we moved used sys.stderr directly. |
|
762 | 762 | # We did not change it to minimise code change. |
|
763 | 763 | # This need to be moved to something proper. |
@@ -798,7 +798,7 def unbundle(repo, proto, heads): | |||
|
798 | 798 | errpart.addparam('parttype', exc.parttype) |
|
799 | 799 | if exc.params: |
|
800 | 800 | errpart.addparam('params', '\0'.join(exc.params)) |
|
801 |
except |
|
|
801 | except error.Abort as exc: | |
|
802 | 802 | manargs = [('message', str(exc))] |
|
803 | 803 | advargs = [] |
|
804 | 804 | if exc.hint is not None: |
@@ -14,7 +14,7 import sys | |||
|
14 | 14 | import threading |
|
15 | 15 | |
|
16 | 16 | from .i18n import _ |
|
17 |
from . import |
|
|
17 | from . import error | |
|
18 | 18 | |
|
19 | 19 | def countcpus(): |
|
20 | 20 | '''try to count the number of CPUs on the system''' |
@@ -45,7 +45,7 def _numworkers(ui): | |||
|
45 | 45 | if n >= 1: |
|
46 | 46 | return n |
|
47 | 47 | except ValueError: |
|
48 |
raise |
|
|
48 | raise error.Abort(_('number of cpus must be an integer')) | |
|
49 | 49 | return min(max(countcpus(), 4), 32) |
|
50 | 50 | |
|
51 | 51 | if os.name == 'posix': |
@@ -1,7 +1,7 | |||
|
1 | 1 | # Extension dedicated to test patch.diff() upgrade modes |
|
2 | 2 | # |
|
3 | 3 | # |
|
4 |
from mercurial import cmdutil, scmutil, patch, |
|
|
4 | from mercurial import cmdutil, scmutil, patch, error | |
|
5 | 5 | |
|
6 | 6 | cmdtable = {} |
|
7 | 7 | command = cmdutil.command(cmdtable) |
@@ -30,9 +30,9 def autodiff(ui, repo, *pats, **opts): | |||
|
30 | 30 | diffopts.git = False |
|
31 | 31 | diffopts.upgrade = True |
|
32 | 32 | def losedatafn(fn=None, **kwargs): |
|
33 |
raise |
|
|
33 | raise error.Abort('losing data for %s' % fn) | |
|
34 | 34 | else: |
|
35 |
raise |
|
|
35 | raise error.Abort('--git must be yes, no or auto') | |
|
36 | 36 | |
|
37 | 37 | node1, node2 = scmutil.revpair(repo, []) |
|
38 | 38 | m = scmutil.match(repo[node2], pats, opts) |
@@ -1,7 +1,7 | |||
|
1 | 1 | $ cat > abortcommit.py <<EOF |
|
2 |
> from mercurial import |
|
|
2 | > from mercurial import error | |
|
3 | 3 | > def hook(**args): |
|
4 |
> raise |
|
|
4 | > raise error.Abort("no commits allowed") | |
|
5 | 5 | > def reposetup(ui, repo): |
|
6 | 6 | > repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook) |
|
7 | 7 | > EOF |
@@ -69,7 +69,7 should all fail | |||
|
69 | 69 | |
|
70 | 70 | $ cd .. |
|
71 | 71 | |
|
72 |
Issue1527: repeated addremove causes |
|
|
72 | Issue1527: repeated addremove causes Abort | |
|
73 | 73 | |
|
74 | 74 | $ hg init rep3; cd rep3 |
|
75 | 75 | $ mkdir d |
@@ -299,7 +299,7 and (2) the extension to allow filelog m | |||
|
299 | 299 | and its ancestor by overriding "repo._filecommit". |
|
300 | 300 | |
|
301 | 301 | $ cat > ../legacyrepo.py <<EOF |
|
302 |
> from mercurial import node, |
|
|
302 | > from mercurial import node, error | |
|
303 | 303 | > def reposetup(ui, repo): |
|
304 | 304 | > class legacyrepo(repo.__class__): |
|
305 | 305 | > def _filecommit(self, fctx, manifest1, manifest2, |
@@ -312,12 +312,12 and its ancestor by overriding "repo._fi | |||
|
312 | 312 | > meta = {} |
|
313 | 313 | > copy = fctx.renamed() |
|
314 | 314 | > if copy and copy[0] != fname: |
|
315 |
> raise |
|
|
315 | > raise error.Abort('copying is not supported') | |
|
316 | 316 | > if fparent2 != node.nullid: |
|
317 | 317 | > changelist.append(fname) |
|
318 | 318 | > return flog.add(text, meta, tr, linkrev, |
|
319 | 319 | > fparent1, fparent2) |
|
320 |
> raise |
|
|
320 | > raise error.Abort('only merging is supported') | |
|
321 | 321 | > repo.__class__ = legacyrepo |
|
322 | 322 | > EOF |
|
323 | 323 |
@@ -453,7 +453,7 Setting up | |||
|
453 | 453 | > used to test error handling in bundle2 |
|
454 | 454 | > """ |
|
455 | 455 | > |
|
456 |
> from mercurial import |
|
|
456 | > from mercurial import error | |
|
457 | 457 | > from mercurial import bundle2 |
|
458 | 458 | > from mercurial import exchange |
|
459 | 459 | > from mercurial import extensions |
@@ -471,7 +471,7 Setting up | |||
|
471 | 471 | > |
|
472 | 472 | > @bundle2.parthandler("test:abort") |
|
473 | 473 | > def handleabort(op, part): |
|
474 |
> raise |
|
|
474 | > raise error.Abort('Abandon ship!', hint="don't panic") | |
|
475 | 475 | > |
|
476 | 476 | > def uisetup(ui): |
|
477 | 477 | > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart |
@@ -90,7 +90,7 Create an extension to test bundle2 API | |||
|
90 | 90 | > try: |
|
91 | 91 | > bundler.addparam(*p) |
|
92 | 92 | > except ValueError, exc: |
|
93 |
> raise |
|
|
93 | > raise error.Abort('%s' % exc) | |
|
94 | 94 | > |
|
95 | 95 | > if opts['compress']: |
|
96 | 96 | > bundler.setcompression(opts['compress']) |
@@ -164,7 +164,7 Create an extension to test bundle2 API | |||
|
164 | 164 | > for chunk in bundler.getchunks(): |
|
165 | 165 | > file.write(chunk) |
|
166 | 166 | > except RuntimeError, exc: |
|
167 |
> raise |
|
|
167 | > raise error.Abort(exc) | |
|
168 | 168 | > |
|
169 | 169 | > @command('unbundle2', [], '') |
|
170 | 170 | > def cmdunbundle2(ui, repo, replypath=None): |
@@ -178,9 +178,9 Create an extension to test bundle2 API | |||
|
178 | 178 | > op = bundle2.processbundle(repo, unbundler, lambda: tr) |
|
179 | 179 | > tr.close() |
|
180 | 180 | > except error.BundleValueError, exc: |
|
181 |
> raise |
|
|
181 | > raise error.Abort('missing support for %s' % exc) | |
|
182 | 182 | > except error.PushRaced, exc: |
|
183 |
> raise |
|
|
183 | > raise error.Abort('push race: %s' % exc) | |
|
184 | 184 | > finally: |
|
185 | 185 | > if tr is not None: |
|
186 | 186 | > tr.release() |
@@ -204,7 +204,7 Create an extension to test bundle2 API | |||
|
204 | 204 | > try: |
|
205 | 205 | > params = unbundler.params |
|
206 | 206 | > except error.BundleValueError, exc: |
|
207 |
> raise |
|
|
207 | > raise error.Abort('unknown parameters: %s' % exc) | |
|
208 | 208 | > ui.write('options count: %i\n' % len(params)) |
|
209 | 209 | > for key in sorted(params): |
|
210 | 210 | > ui.write('- %s\n' % key) |
@@ -10,11 +10,11 | |||
|
10 | 10 | > EOF |
|
11 | 11 | |
|
12 | 12 | $ cat > prefix.py <<EOF |
|
13 |
> from mercurial import |
|
|
13 | > from mercurial import error | |
|
14 | 14 | > def stripprefix(s, cmd, filename, **kwargs): |
|
15 | 15 | > header = '%s\n' % cmd |
|
16 | 16 | > if s[:len(header)] != header: |
|
17 |
> raise |
|
|
17 | > raise error.Abort('missing header "%s" in %s' % (cmd, filename)) | |
|
18 | 18 | > return s[len(header):] |
|
19 | 19 | > def insertprefix(s, cmd): |
|
20 | 20 | > return '%s\n%s' % (cmd, s) |
@@ -66,10 +66,10 Verify that exceptions during a dirstate | |||
|
66 | 66 | coherent (issue4353) |
|
67 | 67 | |
|
68 | 68 | $ cat > ../dirstateexception.py <<EOF |
|
69 |
> from mercurial import merge, extensions, |
|
|
69 | > from mercurial import merge, extensions, error | |
|
70 | 70 | > |
|
71 | 71 | > def wraprecordupdates(orig, repo, actions, branchmerge): |
|
72 |
> raise |
|
|
72 | > raise error.Abort("simulated error while recording dirstateupdates") | |
|
73 | 73 | > |
|
74 | 74 | > def reposetup(ui, repo): |
|
75 | 75 | > extensions.wrapfunction(merge, 'recordupdates', wraprecordupdates) |
@@ -202,12 +202,12 Aborting lock does not prevent fncache w | |||
|
202 | 202 | |
|
203 | 203 | $ cat > exceptionext.py <<EOF |
|
204 | 204 | > import os |
|
205 |
> from mercurial import commands, |
|
|
205 | > from mercurial import commands, error | |
|
206 | 206 | > from mercurial.extensions import wrapfunction |
|
207 | 207 | > |
|
208 | 208 | > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs): |
|
209 | 209 | > def releasewrap(): |
|
210 |
> raise |
|
|
210 | > raise error.Abort("forced lock failure") | |
|
211 | 211 | > return orig(vfs, lockname, wait, releasewrap, *args, **kwargs) |
|
212 | 212 | > |
|
213 | 213 | > def reposetup(ui, repo): |
@@ -231,13 +231,13 Aborting transaction prevents fncache ch | |||
|
231 | 231 | |
|
232 | 232 | $ cat > ../exceptionext.py <<EOF |
|
233 | 233 | > import os |
|
234 |
> from mercurial import commands, |
|
|
234 | > from mercurial import commands, error, localrepo | |
|
235 | 235 | > from mercurial.extensions import wrapfunction |
|
236 | 236 | > |
|
237 | 237 | > def wrapper(orig, self, *args, **kwargs): |
|
238 | 238 | > tr = orig(self, *args, **kwargs) |
|
239 | 239 | > def fail(tr): |
|
240 |
> raise |
|
|
240 | > raise error.Abort("forced transaction failure") | |
|
241 | 241 | > # zzz prefix to ensure it sorted after store.write |
|
242 | 242 | > tr.addfinalize('zzz-forcefails', fail) |
|
243 | 243 | > return tr |
@@ -262,19 +262,19 Aborted transactions can be recovered la | |||
|
262 | 262 | |
|
263 | 263 | $ cat > ../exceptionext.py <<EOF |
|
264 | 264 | > import os |
|
265 |
> from mercurial import commands, |
|
|
265 | > from mercurial import commands, error, transaction, localrepo | |
|
266 | 266 | > from mercurial.extensions import wrapfunction |
|
267 | 267 | > |
|
268 | 268 | > def trwrapper(orig, self, *args, **kwargs): |
|
269 | 269 | > tr = orig(self, *args, **kwargs) |
|
270 | 270 | > def fail(tr): |
|
271 |
> raise |
|
|
271 | > raise error.Abort("forced transaction failure") | |
|
272 | 272 | > # zzz prefix to ensure it sorted after store.write |
|
273 | 273 | > tr.addfinalize('zzz-forcefails', fail) |
|
274 | 274 | > return tr |
|
275 | 275 | > |
|
276 | 276 | > def abortwrapper(orig, self, *args, **kwargs): |
|
277 |
> raise |
|
|
277 | > raise error.Abort("forced transaction failure") | |
|
278 | 278 | > |
|
279 | 279 | > def uisetup(ui): |
|
280 | 280 | > wrapfunction(localrepo.localrepository, 'transaction', trwrapper) |
@@ -298,11 +298,11 modify the message | |||
|
298 | 298 | check saving last-message.txt, at first |
|
299 | 299 | |
|
300 | 300 | $ cat > $TESTTMP/commitfailure.py <<EOF |
|
301 |
> from mercurial import |
|
|
301 | > from mercurial import error | |
|
302 | 302 | > def reposetup(ui, repo): |
|
303 | 303 | > class commitfailure(repo.__class__): |
|
304 | 304 | > def commit(self, *args, **kwargs): |
|
305 |
> raise |
|
|
305 | > raise error.Abort('emulating unexpected abort') | |
|
306 | 306 | > repo.__class__ = commitfailure |
|
307 | 307 | > EOF |
|
308 | 308 | $ cat >> .hg/hgrc <<EOF |
@@ -394,7 +394,7 preoutgoing hook can prevent outgoing ch | |||
|
394 | 394 | $ cd "$TESTTMP/b" |
|
395 | 395 | |
|
396 | 396 | $ cat > hooktests.py <<EOF |
|
397 |
> from mercurial import |
|
|
397 | > from mercurial import error | |
|
398 | 398 | > |
|
399 | 399 | > uncallable = 0 |
|
400 | 400 | > |
@@ -421,7 +421,7 preoutgoing hook can prevent outgoing ch | |||
|
421 | 421 | > raise LocalException('exception from hook') |
|
422 | 422 | > |
|
423 | 423 | > def aborthook(**args): |
|
424 |
> raise |
|
|
424 | > raise error.Abort('raise abort from hook') | |
|
425 | 425 | > |
|
426 | 426 | > def brokenhook(**args): |
|
427 | 427 | > return 1 + {} |
@@ -14,7 +14,7 Prepare | |||
|
14 | 14 | Test that raising an exception in the release function doesn't cause the lock to choke |
|
15 | 15 | |
|
16 | 16 | $ cat > testlock.py << EOF |
|
17 |
> from mercurial import cmdutil, error, |
|
|
17 | > from mercurial import cmdutil, error, error | |
|
18 | 18 | > |
|
19 | 19 | > cmdtable = {} |
|
20 | 20 | > command = cmdutil.command(cmdtable) |
@@ -22,7 +22,7 Test that raising an exception in the re | |||
|
22 | 22 | > def acquiretestlock(repo, releaseexc): |
|
23 | 23 | > def unlock(): |
|
24 | 24 | > if releaseexc: |
|
25 |
> raise |
|
|
25 | > raise error.Abort('expected release exception') | |
|
26 | 26 | > l = repo._lock(repo.vfs, 'testlock', False, unlock, None, 'test lock') |
|
27 | 27 | > return l |
|
28 | 28 | > |
@@ -35,7 +35,7 Test that raising an exception in the re | |||
|
35 | 35 | > try: |
|
36 | 36 | > testlock = acquiretestlock(repo, False) |
|
37 | 37 | > except error.LockHeld: |
|
38 |
> raise |
|
|
38 | > raise error.Abort('lockfile on disk even after releasing!') | |
|
39 | 39 | > testlock.release() |
|
40 | 40 | > EOF |
|
41 | 41 | $ cat >> $HGRCPATH << EOF |
@@ -214,10 +214,10 isn't changed on the filesystem (see als | |||
|
214 | 214 | $ cat > $TESTTMP/abort.py <<EOF |
|
215 | 215 | > # emulate aborting before "recordupdates()". in this case, files |
|
216 | 216 | > # are changed without updating dirstate |
|
217 |
> from mercurial import extensions, merge, |
|
|
217 | > from mercurial import extensions, merge, error | |
|
218 | 218 | > def applyupdates(orig, *args, **kwargs): |
|
219 | 219 | > orig(*args, **kwargs) |
|
220 |
> raise |
|
|
220 | > raise error.Abort('intentional aborting') | |
|
221 | 221 | > def extsetup(ui): |
|
222 | 222 | > extensions.wrapfunction(merge, "applyupdates", applyupdates) |
|
223 | 223 | > EOF |
@@ -149,11 +149,11 Test saving last-message.txt: | |||
|
149 | 149 | $ hg qrefresh -m "original message" |
|
150 | 150 | |
|
151 | 151 | $ cat > $TESTTMP/commitfailure.py <<EOF |
|
152 |
> from mercurial import |
|
|
152 | > from mercurial import error | |
|
153 | 153 | > def reposetup(ui, repo): |
|
154 | 154 | > class commitfailure(repo.__class__): |
|
155 | 155 | > def commit(self, *args, **kwargs): |
|
156 |
> raise |
|
|
156 | > raise error.Abort('emulating unexpected abort') | |
|
157 | 157 | > repo.__class__ = commitfailure |
|
158 | 158 | > EOF |
|
159 | 159 |
@@ -248,11 +248,11 Test saving last-message.txt | |||
|
248 | 248 | $ cd repo |
|
249 | 249 | |
|
250 | 250 | $ cat > $TESTTMP/commitfailure.py <<EOF |
|
251 |
> from mercurial import |
|
|
251 | > from mercurial import error | |
|
252 | 252 | > def reposetup(ui, repo): |
|
253 | 253 | > class commitfailure(repo.__class__): |
|
254 | 254 | > def commit(self, *args, **kwargs): |
|
255 |
> raise |
|
|
255 | > raise error.Abort('emulating unexpected abort') | |
|
256 | 256 | > repo.__class__ = commitfailure |
|
257 | 257 | > EOF |
|
258 | 258 | $ cat >> .hg/hgrc <<EOF |
@@ -108,11 +108,11 Test saving last-message.txt: | |||
|
108 | 108 | > EOF |
|
109 | 109 | |
|
110 | 110 | $ cat > $TESTTMP/commitfailure.py <<EOF |
|
111 |
> from mercurial import |
|
|
111 | > from mercurial import error | |
|
112 | 112 | > def reposetup(ui, repo): |
|
113 | 113 | > class commitfailure(repo.__class__): |
|
114 | 114 | > def commit(self, *args, **kwargs): |
|
115 |
> raise |
|
|
115 | > raise error.Abort('emulating unexpected abort') | |
|
116 | 116 | > repo.__class__ = commitfailure |
|
117 | 117 | > EOF |
|
118 | 118 |
@@ -15,7 +15,7 | |||
|
15 | 15 | |
|
16 | 16 | import unittest |
|
17 | 17 | from unittest import TestCase |
|
18 | from mercurial import util, simplemerge | |
|
18 | from mercurial import util, simplemerge, error | |
|
19 | 19 | |
|
20 | 20 | # bzr compatible interface, for the tests |
|
21 | 21 | class Merge3(simplemerge.Merge3Text): |
@@ -29,7 +29,7 class Merge3(simplemerge.Merge3Text): | |||
|
29 | 29 | atext = '\n'.join([i.strip('\n') for i in a] + ['']) |
|
30 | 30 | btext = '\n'.join([i.strip('\n') for i in b] + ['']) |
|
31 | 31 | if util.binary(basetext) or util.binary(atext) or util.binary(btext): |
|
32 |
raise |
|
|
32 | raise error.Abort("don't know how to merge binary files") | |
|
33 | 33 | simplemerge.Merge3Text.__init__(self, basetext, atext, btext, |
|
34 | 34 | base, a, b) |
|
35 | 35 | |
@@ -321,7 +321,7 bbb | |||
|
321 | 321 | self.assertEquals(ml, MERGED_RESULT) |
|
322 | 322 | |
|
323 | 323 | def test_binary(self): |
|
324 |
self.assertRaises( |
|
|
324 | self.assertRaises(error.Abort, Merge3, ['\x00'], ['a'], ['b']) | |
|
325 | 325 | |
|
326 | 326 | def test_dos_text(self): |
|
327 | 327 | base_text = 'a\r\n' |
@@ -1028,8 +1028,8 Create repo without default path, pull t | |||
|
1028 | 1028 | |
|
1029 | 1029 | Ensure a full traceback, not just the SubrepoAbort part |
|
1030 | 1030 | |
|
1031 |
$ hg -R issue1852b update --traceback 2>&1 | grep 'raise |
|
|
1032 |
raise |
|
|
1031 | $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort' | |
|
1032 | raise error.Abort(_("default path for subrepository not found")) | |
|
1033 | 1033 | |
|
1034 | 1034 | Pull -u now doesn't help |
|
1035 | 1035 |
General Comments 0
You need to be logged in to leave comments.
Login now