##// END OF EJS Templates
cleanup: eradicate long lines
Brodie Rao -
r16683:525fdb73 default
parent child Browse files
Show More
@@ -139,7 +139,8 b' pypats = ['
139 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
139 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
140 (r'[^\n]\Z', "no trailing newline"),
140 (r'[^\n]\Z', "no trailing newline"),
141 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
141 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
142 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
142 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
143 # "don't use underbars in identifiers"),
143 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
144 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
144 "don't use camelcase in identifiers"),
145 "don't use camelcase in identifiers"),
145 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
146 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
@@ -42,7 +42,8 b' def perfwalk(ui, repo, *pats):'
42
42
43 def perfstatus(ui, repo, *pats):
43 def perfstatus(ui, repo, *pats):
44 #m = match.always(repo.root, repo.getcwd())
44 #m = match.always(repo.root, repo.getcwd())
45 #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False, False))))
45 #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False,
46 # False))))
46 timer(lambda: sum(map(len, repo.status())))
47 timer(lambda: sum(map(len, repo.status())))
47
48
48 def perfheads(ui, repo):
49 def perfheads(ui, repo):
@@ -102,9 +102,9 b' def show_doc(ui):'
102 ui.write("\n")
102 ui.write("\n")
103
103
104 section(ui, _("Extensions"))
104 section(ui, _("Extensions"))
105 ui.write(_("This section contains help for extensions that are distributed "
105 ui.write(_("This section contains help for extensions that are "
106 "together with Mercurial. Help for other extensions is available "
106 "distributed together with Mercurial. Help for other "
107 "in the help system."))
107 "extensions is available in the help system."))
108 ui.write("\n\n"
108 ui.write("\n\n"
109 ".. contents::\n"
109 ".. contents::\n"
110 " :class: htmlonly\n"
110 " :class: htmlonly\n"
@@ -416,7 +416,8 b' class bzmysql(bzaccess):'
416 for id in bugs.keys():
416 for id in bugs.keys():
417 self.ui.status(_(' bug %s\n') % id)
417 self.ui.status(_(' bug %s\n') % id)
418 cmdfmt = self.ui.config('bugzilla', 'notify', self.default_notify)
418 cmdfmt = self.ui.config('bugzilla', 'notify', self.default_notify)
419 bzdir = self.ui.config('bugzilla', 'bzdir', '/var/www/html/bugzilla')
419 bzdir = self.ui.config('bugzilla', 'bzdir',
420 '/var/www/html/bugzilla')
420 try:
421 try:
421 # Backwards-compatible with old notify string, which
422 # Backwards-compatible with old notify string, which
422 # took one string. This will throw with a new format
423 # took one string. This will throw with a new format
@@ -468,8 +469,8 b' class bzmysql(bzaccess):'
468 userid = self.get_user_id(defaultuser)
469 userid = self.get_user_id(defaultuser)
469 user = defaultuser
470 user = defaultuser
470 except KeyError:
471 except KeyError:
471 raise util.Abort(_('cannot find bugzilla user id for %s or %s') %
472 raise util.Abort(_('cannot find bugzilla user id for %s or %s')
472 (user, defaultuser))
473 % (user, defaultuser))
473 return (user, userid)
474 return (user, userid)
474
475
475 def updatebug(self, bugid, newstate, text, committer):
476 def updatebug(self, bugid, newstate, text, committer):
@@ -328,7 +328,8 b' cmdtable = {'
328 ('', 'root', '', _('specify cvsroot')),
328 ('', 'root', '', _('specify cvsroot')),
329 # Options specific to builtin cvsps
329 # Options specific to builtin cvsps
330 ('', 'parents', '', _('show parent changesets')),
330 ('', 'parents', '', _('show parent changesets')),
331 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
331 ('', 'ancestors', '',
332 _('show current changeset in ancestor branches')),
332 # Options that are ignored for compatibility with cvsps-2.1
333 # Options that are ignored for compatibility with cvsps-2.1
333 ('A', 'cvs-direct', None, _('ignored for compatibility')),
334 ('A', 'cvs-direct', None, _('ignored for compatibility')),
334 ],
335 ],
@@ -121,12 +121,13 b' class convert_cvs(converter_source):'
121 pf = open(cvspass)
121 pf = open(cvspass)
122 for line in pf.read().splitlines():
122 for line in pf.read().splitlines():
123 part1, part2 = line.split(' ', 1)
123 part1, part2 = line.split(' ', 1)
124 # /1 :pserver:user@example.com:2401/cvsroot/foo
125 # Ah<Z
124 if part1 == '/1':
126 if part1 == '/1':
125 # /1 :pserver:user@example.com:2401/cvsroot/foo Ah<Z
126 part1, part2 = part2.split(' ', 1)
127 part1, part2 = part2.split(' ', 1)
127 format = format1
128 format = format1
129 # :pserver:user@example.com:/cvsroot/foo Ah<Z
128 else:
130 else:
129 # :pserver:user@example.com:/cvsroot/foo Ah<Z
130 format = format0
131 format = format0
131 if part1 == format:
132 if part1 == format:
132 passw = part2
133 passw = part2
@@ -336,7 +336,8 b' def createlog(ui, directory=None, root="'
336 else:
336 else:
337 myrev = '.'.join(myrev[:-2] + ['0', myrev[-2]])
337 myrev = '.'.join(myrev[:-2] + ['0', myrev[-2]])
338 branches = [b for b in branchmap if branchmap[b] == myrev]
338 branches = [b for b in branchmap if branchmap[b] == myrev]
339 assert len(branches) == 1, 'unknown branch: %s' % e.mergepoint
339 assert len(branches) == 1, ('unknown branch: %s'
340 % e.mergepoint)
340 e.mergepoint = branches[0]
341 e.mergepoint = branches[0]
341 else:
342 else:
342 e.mergepoint = None
343 e.mergepoint = None
@@ -181,8 +181,8 b' class convert_git(converter_source):'
181 m, f = l[:-1].split("\t")
181 m, f = l[:-1].split("\t")
182 changes.append(f)
182 changes.append(f)
183 else:
183 else:
184 fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
184 fh = self.gitopen('git diff-tree --name-only --root -r %s '
185 % (version, version, i + 1))
185 '"%s^%s" --' % (version, version, i + 1))
186 changes = [f.rstrip('\n') for f in fh]
186 changes = [f.rstrip('\n') for f in fh]
187 if fh.close():
187 if fh.close():
188 raise util.Abort(_('cannot read changes in %s') % version)
188 raise util.Abort(_('cannot read changes in %s') % version)
@@ -294,7 +294,8 b' class mercurial_source(converter_source)'
294 if not parents:
294 if not parents:
295 files = sorted(ctx.manifest())
295 files = sorted(ctx.manifest())
296 # getcopies() is not needed for roots, but it is a simple way to
296 # getcopies() is not needed for roots, but it is a simple way to
297 # detect missing revlogs and abort on errors or populate self.ignored
297 # detect missing revlogs and abort on errors or populate
298 # self.ignored
298 self.getcopies(ctx, parents, files)
299 self.getcopies(ctx, parents, files)
299 return [(f, rev) for f in files if f not in self.ignored], {}
300 return [(f, rev) for f in files if f not in self.ignored], {}
300 if self._changescache and self._changescache[0] == rev:
301 if self._changescache and self._changescache[0] == rev:
@@ -85,8 +85,8 b' class changedpath(object):'
85 self.copyfrom_rev = p.copyfrom_rev
85 self.copyfrom_rev = p.copyfrom_rev
86 self.action = p.action
86 self.action = p.action
87
87
88 def get_log_child(fp, url, paths, start, end, limit=0, discover_changed_paths=True,
88 def get_log_child(fp, url, paths, start, end, limit=0,
89 strict_node_history=False):
89 discover_changed_paths=True, strict_node_history=False):
90 protocol = -1
90 protocol = -1
91 def receiver(orig_paths, revnum, author, date, message, pool):
91 def receiver(orig_paths, revnum, author, date, message, pool):
92 if orig_paths is not None:
92 if orig_paths is not None:
@@ -276,7 +276,8 b' class svn_source(converter_source):'
276 except ValueError:
276 except ValueError:
277 raise util.Abort(_('svn: revision %s is not an integer') % rev)
277 raise util.Abort(_('svn: revision %s is not an integer') % rev)
278
278
279 self.trunkname = self.ui.config('convert', 'svn.trunk', 'trunk').strip('/')
279 self.trunkname = self.ui.config('convert', 'svn.trunk',
280 'trunk').strip('/')
280 self.startrev = self.ui.config('convert', 'svn.startrev', default=0)
281 self.startrev = self.ui.config('convert', 'svn.startrev', default=0)
281 try:
282 try:
282 self.startrev = int(self.startrev)
283 self.startrev = int(self.startrev)
@@ -862,7 +863,8 b' class svn_source(converter_source):'
862 pass
863 pass
863 except SubversionException, (inst, num):
864 except SubversionException, (inst, num):
864 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
865 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
865 raise util.Abort(_('svn: branch has no revision %s') % to_revnum)
866 raise util.Abort(_('svn: branch has no revision %s')
867 % to_revnum)
866 raise
868 raise
867
869
868 def getfile(self, file, rev):
870 def getfile(self, file, rev):
@@ -949,8 +951,8 b' class svn_source(converter_source):'
949 if not p.startswith('/'):
951 if not p.startswith('/'):
950 p = self.module + '/' + p
952 p = self.module + '/' + p
951 relpaths.append(p.strip('/'))
953 relpaths.append(p.strip('/'))
952 args = [self.baseurl, relpaths, start, end, limit, discover_changed_paths,
954 args = [self.baseurl, relpaths, start, end, limit,
953 strict_node_history]
955 discover_changed_paths, strict_node_history]
954 arg = encodeargs(args)
956 arg = encodeargs(args)
955 hgexe = util.hgexecutable()
957 hgexe = util.hgexecutable()
956 cmd = '%s debugsvnlog' % util.shellquote(hgexe)
958 cmd = '%s debugsvnlog' % util.shellquote(hgexe)
@@ -111,7 +111,8 b' def tolf(s, params, ui, **kwargs):'
111 return s
111 return s
112 if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
112 if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
113 return s
113 return s
114 if ui.configbool('eol', 'fix-trailing-newline', False) and s and s[-1] != '\n':
114 if (ui.configbool('eol', 'fix-trailing-newline', False)
115 and s and s[-1] != '\n'):
115 s = s + '\n'
116 s = s + '\n'
116 return eolre.sub('\n', s)
117 return eolre.sub('\n', s)
117
118
@@ -121,7 +122,8 b' def tocrlf(s, params, ui, **kwargs):'
121 return s
122 return s
122 if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
123 if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
123 return s
124 return s
124 if ui.configbool('eol', 'fix-trailing-newline', False) and s and s[-1] != '\n':
125 if (ui.configbool('eol', 'fix-trailing-newline', False)
126 and s and s[-1] != '\n'):
125 s = s + '\n'
127 s = s + '\n'
126 return eolre.sub('\r\n', s)
128 return eolre.sub('\r\n', s)
127
129
@@ -95,7 +95,8 b' def catcommit(ui, repo, n, prefix, ctx=N'
95 nlprefix = '\n' + prefix
95 nlprefix = '\n' + prefix
96 if ctx is None:
96 if ctx is None:
97 ctx = repo[n]
97 ctx = repo[n]
98 ui.write("tree %s\n" % short(ctx.changeset()[0])) # use ctx.node() instead ??
98 # use ctx.node() instead ??
99 ui.write("tree %s\n" % short(ctx.changeset()[0]))
99 for p in ctx.parents():
100 for p in ctx.parents():
100 ui.write("parent %s\n" % p)
101 ui.write("parent %s\n" % p)
101
102
@@ -113,7 +114,8 b' def catcommit(ui, repo, n, prefix, ctx=N'
113 ui.write("branch %s\n\n" % ctx.branch())
114 ui.write("branch %s\n\n" % ctx.branch())
114
115
115 if prefix != "":
116 if prefix != "":
116 ui.write("%s%s\n" % (prefix, description.replace('\n', nlprefix).strip()))
117 ui.write("%s%s\n" % (prefix,
118 description.replace('\n', nlprefix).strip()))
117 else:
119 else:
118 ui.write(description + "\n")
120 ui.write(description + "\n")
119 if prefix:
121 if prefix:
@@ -51,11 +51,13 b' def generate_css(web, req, tmpl):'
51 pg_style = web.config('web', 'pygments_style', 'colorful')
51 pg_style = web.config('web', 'pygments_style', 'colorful')
52 fmter = highlight.HtmlFormatter(style = pg_style)
52 fmter = highlight.HtmlFormatter(style = pg_style)
53 req.respond(common.HTTP_OK, 'text/css')
53 req.respond(common.HTTP_OK, 'text/css')
54 return ['/* pygments_style = %s */\n\n' % pg_style, fmter.get_style_defs('')]
54 return ['/* pygments_style = %s */\n\n' % pg_style,
55 fmter.get_style_defs('')]
55
56
56 def extsetup():
57 def extsetup():
57 # monkeypatch in the new version
58 # monkeypatch in the new version
58 extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight)
59 extensions.wrapfunction(webcommands, '_filerevision',
60 filerevision_highlight)
59 extensions.wrapfunction(webcommands, 'annotate', annotate_highlight)
61 extensions.wrapfunction(webcommands, 'annotate', annotate_highlight)
60 webcommands.highlightcss = generate_css
62 webcommands.highlightcss = generate_css
61 webcommands.__all__.append('highlightcss')
63 webcommands.__all__.append('highlightcss')
@@ -46,7 +46,8 b' def reposetup(ui, repo):'
46 files = match.files()
46 files = match.files()
47 if '.' in files:
47 if '.' in files:
48 files = []
48 files = []
49 if self._inotifyon and not ignored and not subrepos and not self._dirty:
49 if (self._inotifyon and not ignored and not subrepos and
50 not self._dirty):
50 cli = client(ui, repo)
51 cli = client(ui, repo)
51 try:
52 try:
52 result = cli.statusquery(files, match, False,
53 result = cli.statusquery(files, match, False,
@@ -1246,9 +1246,11 b' class queue(object):'
1246 raise util.Abort(
1246 raise util.Abort(
1247 _("cannot use --exact and --check together"))
1247 _("cannot use --exact and --check together"))
1248 if move:
1248 if move:
1249 raise util.Abort(_("cannot use --exact and --move together"))
1249 raise util.Abort(_('cannot use --exact and --move '
1250 'together'))
1250 if self.applied:
1251 if self.applied:
1251 raise util.Abort(_("cannot push --exact with applied patches"))
1252 raise util.Abort(_('cannot push --exact with applied '
1253 'patches'))
1252 root = self.series[start]
1254 root = self.series[start]
1253 target = patchheader(self.join(root), self.plainmode).parent
1255 target = patchheader(self.join(root), self.plainmode).parent
1254 if not target:
1256 if not target:
@@ -2187,7 +2189,8 b' def init(ui, repo, **opts):'
2187
2189
2188 @command("qclone",
2190 @command("qclone",
2189 [('', 'pull', None, _('use pull protocol to copy metadata')),
2191 [('', 'pull', None, _('use pull protocol to copy metadata')),
2190 ('U', 'noupdate', None, _('do not update the new working directories')),
2192 ('U', 'noupdate', None,
2193 _('do not update the new working directories')),
2191 ('', 'uncompressed', None,
2194 ('', 'uncompressed', None,
2192 _('use uncompressed transfer (fast over LAN)')),
2195 _('use uncompressed transfer (fast over LAN)')),
2193 ('p', 'patches', '',
2196 ('p', 'patches', '',
@@ -2289,7 +2292,8 b' def series(ui, repo, **opts):'
2289 """print the entire series file
2292 """print the entire series file
2290
2293
2291 Returns 0 on success."""
2294 Returns 0 on success."""
2292 repo.mq.qseries(repo, missing=opts.get('missing'), summary=opts.get('summary'))
2295 repo.mq.qseries(repo, missing=opts.get('missing'),
2296 summary=opts.get('summary'))
2293 return 0
2297 return 0
2294
2298
2295 @command("qtop", seriesopts, _('hg qtop [-s]'))
2299 @command("qtop", seriesopts, _('hg qtop [-s]'))
@@ -2510,7 +2514,8 b' def fold(ui, repo, *files, **opts):'
2510 if p in patches or p == parent:
2514 if p in patches or p == parent:
2511 ui.warn(_('Skipping already folded patch %s\n') % p)
2515 ui.warn(_('Skipping already folded patch %s\n') % p)
2512 if q.isapplied(p):
2516 if q.isapplied(p):
2513 raise util.Abort(_('qfold cannot fold already applied patch %s') % p)
2517 raise util.Abort(_('qfold cannot fold already applied patch %s')
2518 % p)
2514 patches.append(p)
2519 patches.append(p)
2515
2520
2516 for p in patches:
2521 for p in patches:
@@ -2618,7 +2623,8 b' def guard(ui, repo, *args, **opts):'
2618 args = list(args)
2623 args = list(args)
2619 if opts.get('list'):
2624 if opts.get('list'):
2620 if args or opts.get('none'):
2625 if args or opts.get('none'):
2621 raise util.Abort(_('cannot mix -l/--list with options or arguments'))
2626 raise util.Abort(_('cannot mix -l/--list with options or '
2627 'arguments'))
2622 for i in xrange(len(q.series)):
2628 for i in xrange(len(q.series)):
2623 status(i)
2629 status(i)
2624 return
2630 return
@@ -2684,7 +2690,8 b' def savename(path):'
2684 @command("^qpush",
2690 @command("^qpush",
2685 [('c', 'check', None, _('tolerate non-conflicting local changes')),
2691 [('c', 'check', None, _('tolerate non-conflicting local changes')),
2686 ('f', 'force', None, _('apply on top of local changes')),
2692 ('f', 'force', None, _('apply on top of local changes')),
2687 ('e', 'exact', None, _('apply the target patch to its recorded parent')),
2693 ('e', 'exact', None,
2694 _('apply the target patch to its recorded parent')),
2688 ('l', 'list', None, _('list patch name in commit text')),
2695 ('l', 'list', None, _('list patch name in commit text')),
2689 ('a', 'all', None, _('apply all patches')),
2696 ('a', 'all', None, _('apply all patches')),
2690 ('m', 'merge', None, _('merge from another queue (DEPRECATED)')),
2697 ('m', 'merge', None, _('merge from another queue (DEPRECATED)')),
@@ -3374,8 +3381,8 b' def reposetup(ui, repo):'
3374 tags = result[0]
3381 tags = result[0]
3375 for patch in mqtags:
3382 for patch in mqtags:
3376 if patch[1] in tags:
3383 if patch[1] in tags:
3377 self.ui.warn(_('Tag %s overrides mq patch of the same name\n')
3384 self.ui.warn(_('Tag %s overrides mq patch of the same '
3378 % patch[1])
3385 'name\n') % patch[1])
3379 else:
3386 else:
3380 tags[patch[1]] = patch[0]
3387 tags[patch[1]] = patch[0]
3381
3388
@@ -353,8 +353,8 b' def hook(ui, repo, hooktype, node=None, '
353 author = repo[rev].user()
353 author = repo[rev].user()
354 else:
354 else:
355 data += ui.popbuffer()
355 data += ui.popbuffer()
356 ui.note(_('notify: suppressing notification for merge %d:%s\n') %
356 ui.note(_('notify: suppressing notification for merge %d:%s\n')
357 (rev, repo[rev].hex()[:12]))
357 % (rev, repo[rev].hex()[:12]))
358 ui.pushbuffer()
358 ui.pushbuffer()
359 if count:
359 if count:
360 n.diff(ctx, repo['tip'])
360 n.diff(ctx, repo['tip'])
@@ -109,7 +109,8 b' def makepatch(ui, repo, patchlines, opts'
109 msg = email.MIMEMultipart.MIMEMultipart()
109 msg = email.MIMEMultipart.MIMEMultipart()
110 if body:
110 if body:
111 msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
111 msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
112 p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', opts.get('test'))
112 p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch',
113 opts.get('test'))
113 binnode = bin(node)
114 binnode = bin(node)
114 # if node is mq patch, it will have the patch file's name as a tag
115 # if node is mq patch, it will have the patch file's name as a tag
115 if not patchname:
116 if not patchname:
@@ -119,7 +120,8 b' def makepatch(ui, repo, patchlines, opts'
119 patchname = patchtags[0]
120 patchname = patchtags[0]
120 elif total > 1:
121 elif total > 1:
121 patchname = cmdutil.makefilename(repo, '%b-%n.patch',
122 patchname = cmdutil.makefilename(repo, '%b-%n.patch',
122 binnode, seqno=idx, total=total)
123 binnode, seqno=idx,
124 total=total)
123 else:
125 else:
124 patchname = cmdutil.makefilename(repo, '%b.patch', binnode)
126 patchname = cmdutil.makefilename(repo, '%b.patch', binnode)
125 disposition = 'inline'
127 disposition = 'inline'
@@ -516,10 +516,11 b' def dorecord(ui, repo, commitfunc, cmdsu'
516 '(use "hg commit" instead)'))
516 '(use "hg commit" instead)'))
517
517
518 changes = repo.status(match=match)[:3]
518 changes = repo.status(match=match)[:3]
519 diffopts = mdiff.diffopts(git=True, nodates=True,
519 diffopts = mdiff.diffopts(
520 ignorews=opts.get('ignore_all_space'),
520 git=True, nodates=True,
521 ignorewsamount=opts.get('ignore_space_change'),
521 ignorews=opts.get('ignore_all_space'),
522 ignoreblanklines=opts.get('ignore_blank_lines'))
522 ignorewsamount=opts.get('ignore_space_change'),
523 ignoreblanklines=opts.get('ignore_blank_lines'))
523 chunks = patch.diff(repo, changes=changes, opts=diffopts)
524 chunks = patch.diff(repo, changes=changes, opts=diffopts)
524 fp = cStringIO.StringIO()
525 fp = cStringIO.StringIO()
525 fp.write(''.join(chunks))
526 fp.write(''.join(chunks))
@@ -119,7 +119,8 b' class hgwebdirzc(hgwebdir_mod.hgwebdir):'
119 name = os.path.basename(repo)
119 name = os.path.basename(repo)
120 path = (prefix + repo).strip('/')
120 path = (prefix + repo).strip('/')
121 desc = u.config('web', 'description', name)
121 desc = u.config('web', 'description', name)
122 publish(name, desc, path, util.getport(u.config("web", "port", 8000)))
122 publish(name, desc, path,
123 util.getport(u.config("web", "port", 8000)))
123
124
124 # listen
125 # listen
125
126
@@ -323,13 +323,16 b' def getremotechanges(ui, repo, other, on'
323
323
324 Returns a tuple (local, csets, cleanupfn):
324 Returns a tuple (local, csets, cleanupfn):
325
325
326 "local" is a local repo from which to obtain the actual incoming changesets; it
326 "local" is a local repo from which to obtain the actual incoming
327 is a bundlerepo for the obtained bundle when the original "other" is remote.
327 changesets; it is a bundlerepo for the obtained bundle when the
328 original "other" is remote.
328 "csets" lists the incoming changeset node ids.
329 "csets" lists the incoming changeset node ids.
329 "cleanupfn" must be called without arguments when you're done processing the
330 "cleanupfn" must be called without arguments when you're done processing
330 changes; it closes both the original "other" and the one returned here.
331 the changes; it closes both the original "other" and the one returned
332 here.
331 '''
333 '''
332 tmp = discovery.findcommonincoming(repo, other, heads=onlyheads, force=force)
334 tmp = discovery.findcommonincoming(repo, other, heads=onlyheads,
335 force=force)
333 common, incoming, rheads = tmp
336 common, incoming, rheads = tmp
334 if not incoming:
337 if not incoming:
335 try:
338 try:
@@ -1687,7 +1687,8 b' def debugdag(ui, repo, file_=None, *revs'
1687 revs = set((int(r) for r in revs))
1687 revs = set((int(r) for r in revs))
1688 def events():
1688 def events():
1689 for r in rlog:
1689 for r in rlog:
1690 yield 'n', (r, list(set(p for p in rlog.parentrevs(r) if p != -1)))
1690 yield 'n', (r, list(set(p for p in rlog.parentrevs(r)
1691 if p != -1)))
1691 if r in revs:
1692 if r in revs:
1692 yield 'l', (r, "r%i" % r)
1693 yield 'l', (r, "r%i" % r)
1693 elif repo:
1694 elif repo:
@@ -1706,7 +1707,8 b' def debugdag(ui, repo, file_=None, *revs'
1706 if newb != b:
1707 if newb != b:
1707 yield 'a', newb
1708 yield 'a', newb
1708 b = newb
1709 b = newb
1709 yield 'n', (r, list(set(p for p in cl.parentrevs(r) if p != -1)))
1710 yield 'n', (r, list(set(p for p in cl.parentrevs(r)
1711 if p != -1)))
1710 if tags:
1712 if tags:
1711 ls = labels.get(r)
1713 ls = labels.get(r)
1712 if ls:
1714 if ls:
@@ -1764,7 +1766,8 b' def debugdate(ui, date, range=None, **op'
1764 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
1766 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
1765 def debugdiscovery(ui, repo, remoteurl="default", **opts):
1767 def debugdiscovery(ui, repo, remoteurl="default", **opts):
1766 """runs the changeset discovery protocol in isolation"""
1768 """runs the changeset discovery protocol in isolation"""
1767 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
1769 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
1770 opts.get('branch'))
1768 remote = hg.peer(repo, opts, remoteurl)
1771 remote = hg.peer(repo, opts, remoteurl)
1769 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
1772 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
1770
1773
@@ -1774,7 +1777,8 b' def debugdiscovery(ui, repo, remoteurl="'
1774 def doit(localheads, remoteheads):
1777 def doit(localheads, remoteheads):
1775 if opts.get('old'):
1778 if opts.get('old'):
1776 if localheads:
1779 if localheads:
1777 raise util.Abort('cannot use localheads with old style discovery')
1780 raise util.Abort('cannot use localheads with old style '
1781 'discovery')
1778 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
1782 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
1779 force=True)
1783 force=True)
1780 common = set(common)
1784 common = set(common)
@@ -1901,7 +1905,8 b' def debugindex(ui, repo, file_ = None, *'
1901 " nodeid p1 p2\n")
1905 " nodeid p1 p2\n")
1902 elif format == 1:
1906 elif format == 1:
1903 ui.write(" rev flag offset length"
1907 ui.write(" rev flag offset length"
1904 " size " + basehdr + " link p1 p2 nodeid\n")
1908 " size " + basehdr + " link p1 p2"
1909 " nodeid\n")
1905
1910
1906 for i in r:
1911 for i in r:
1907 node = r.node(i)
1912 node = r.node(i)
@@ -2026,8 +2031,8 b' def debuginstall(ui):'
2026 def debugknown(ui, repopath, *ids, **opts):
2031 def debugknown(ui, repopath, *ids, **opts):
2027 """test whether node ids are known to a repo
2032 """test whether node ids are known to a repo
2028
2033
2029 Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
2034 Every ID must be a full-length hex node id string. Returns a list of 0s
2030 indicating unknown/known.
2035 and 1s indicating unknown/known.
2031 """
2036 """
2032 repo = hg.peer(ui, opts, repopath)
2037 repo = hg.peer(ui, opts, repopath)
2033 if not repo.capable('known'):
2038 if not repo.capable('known'):
@@ -2259,13 +2264,17 b' def debugrevlog(ui, repo, file_ = None, '
2259 fmt2 = pcfmtstr(numdeltas, 4)
2264 fmt2 = pcfmtstr(numdeltas, 4)
2260 ui.write('deltas against prev : ' + fmt % pcfmt(numprev, numdeltas))
2265 ui.write('deltas against prev : ' + fmt % pcfmt(numprev, numdeltas))
2261 if numprev > 0:
2266 if numprev > 0:
2262 ui.write(' where prev = p1 : ' + fmt2 % pcfmt(nump1prev, numprev))
2267 ui.write(' where prev = p1 : ' + fmt2 % pcfmt(nump1prev,
2263 ui.write(' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev))
2268 numprev))
2264 ui.write(' other : ' + fmt2 % pcfmt(numoprev, numprev))
2269 ui.write(' where prev = p2 : ' + fmt2 % pcfmt(nump2prev,
2270 numprev))
2271 ui.write(' other : ' + fmt2 % pcfmt(numoprev,
2272 numprev))
2265 if gdelta:
2273 if gdelta:
2266 ui.write('deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas))
2274 ui.write('deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas))
2267 ui.write('deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas))
2275 ui.write('deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas))
2268 ui.write('deltas against other : ' + fmt % pcfmt(numother, numdeltas))
2276 ui.write('deltas against other : ' + fmt % pcfmt(numother,
2277 numdeltas))
2269
2278
2270 @command('debugrevspec', [], ('REVSPEC'))
2279 @command('debugrevspec', [], ('REVSPEC'))
2271 def debugrevspec(ui, repo, expr):
2280 def debugrevspec(ui, repo, expr):
@@ -4433,7 +4442,8 b' def postincoming(ui, repo, modheads, opt'
4433 if currentbranchheads == modheads:
4442 if currentbranchheads == modheads:
4434 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
4443 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
4435 elif currentbranchheads > 1:
4444 elif currentbranchheads > 1:
4436 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to merge)\n"))
4445 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to "
4446 "merge)\n"))
4437 else:
4447 else:
4438 ui.status(_("(run 'hg heads' to see heads)\n"))
4448 ui.status(_("(run 'hg heads' to see heads)\n"))
4439 else:
4449 else:
@@ -5405,7 +5415,8 b' def summary(ui, repo, **opts):'
5405 t = []
5415 t = []
5406 source, branches = hg.parseurl(ui.expandpath('default'))
5416 source, branches = hg.parseurl(ui.expandpath('default'))
5407 other = hg.peer(repo, {}, source)
5417 other = hg.peer(repo, {}, source)
5408 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
5418 revs, checkout = hg.addbranchrevs(repo, other, branches,
5419 opts.get('rev'))
5409 ui.debug('comparing with %s\n' % util.hidepassword(source))
5420 ui.debug('comparing with %s\n' % util.hidepassword(source))
5410 repo.ui.pushbuffer()
5421 repo.ui.pushbuffer()
5411 commoninc = discovery.findcommonincoming(repo, other)
5422 commoninc = discovery.findcommonincoming(repo, other)
@@ -142,8 +142,8 b' class server(object):'
142 else:
142 else:
143 logfile = open(logpath, 'a')
143 logfile = open(logpath, 'a')
144
144
145 # the ui here is really the repo ui so take its baseui so we don't end up
145 # the ui here is really the repo ui so take its baseui so we don't end
146 # with its local configuration
146 # up with its local configuration
147 self.ui = repo.baseui
147 self.ui = repo.baseui
148 self.repo = repo
148 self.repo = repo
149 self.repoui = repo.ui
149 self.repoui = repo.ui
@@ -233,7 +233,8 b' class changectx(object):'
233 _('not found in manifest'))
233 _('not found in manifest'))
234 if '_manifestdelta' in self.__dict__ or path in self.files():
234 if '_manifestdelta' in self.__dict__ or path in self.files():
235 if path in self._manifestdelta:
235 if path in self._manifestdelta:
236 return self._manifestdelta[path], self._manifestdelta.flags(path)
236 return (self._manifestdelta[path],
237 self._manifestdelta.flags(path))
237 node, flag = self._repo.manifest.find(self._changeset[0], path)
238 node, flag = self._repo.manifest.find(self._changeset[0], path)
238 if not node:
239 if not node:
239 raise error.LookupError(self._node, path,
240 raise error.LookupError(self._node, path,
@@ -268,7 +268,8 b' def parsedag(desc):'
268 s += c
268 s += c
269 i += 1
269 i += 1
270 c = nextch()
270 c = nextch()
271 raise util.Abort(_("invalid character in dag description: %s...") % s)
271 raise util.Abort(_('invalid character in dag description: '
272 '%s...') % s)
272
273
273 def dagtextlines(events,
274 def dagtextlines(events,
274 addspaces=True,
275 addspaces=True,
@@ -436,7 +437,9 b' def dagtext(dag,'
436 >>> dagtext([('n', (0, [-1])), ('a', 'ann'), ('n', (1, [0]))])
437 >>> dagtext([('n', (0, [-1])), ('a', 'ann'), ('n', (1, [0]))])
437 '+1 @ann +1'
438 '+1 @ann +1'
438
439
439 >>> dagtext([('n', (0, [-1])), ('a', 'my annotation'), ('n', (1, [0]))])
440 >>> dagtext([('n', (0, [-1])),
441 ... ('a', 'my annotation'),
442 ... ('n', (1, [0]))])
440 '+1 @"my annotation" +1'
443 '+1 @"my annotation" +1'
441
444
442 Commands:
445 Commands:
@@ -447,7 +450,9 b' def dagtext(dag,'
447 >>> dagtext([('n', (0, [-1])), ('c', 'my command'), ('n', (1, [0]))])
450 >>> dagtext([('n', (0, [-1])), ('c', 'my command'), ('n', (1, [0]))])
448 '+1 !"my command" +1'
451 '+1 !"my command" +1'
449
452
450 >>> dagtext([('n', (0, [-1])), ('C', 'my command line'), ('n', (1, [0]))])
453 >>> dagtext([('n', (0, [-1])),
454 ... ('C', 'my command line'),
455 ... ('n', (1, [0]))])
451 '+1 !!my command line\\n+1'
456 '+1 !!my command line\\n+1'
452
457
453 Comments:
458 Comments:
@@ -695,7 +695,8 b' class dirstate(object):'
695 if not skipstep3 and not exact:
695 if not skipstep3 and not exact:
696 visit = sorted([f for f in dmap if f not in results and matchfn(f)])
696 visit = sorted([f for f in dmap if f not in results and matchfn(f)])
697 for nf, st in zip(visit, util.statfiles([join(i) for i in visit])):
697 for nf, st in zip(visit, util.statfiles([join(i) for i in visit])):
698 if not st is None and not getkind(st.st_mode) in (regkind, lnkkind):
698 if (not st is None and
699 not getkind(st.st_mode) in (regkind, lnkkind)):
699 st = None
700 st = None
700 results[nf] = st
701 results[nf] = st
701 for s in subrepos:
702 for s in subrepos:
@@ -86,13 +86,14 b' class outgoing(object):'
86 self._computecommonmissing()
86 self._computecommonmissing()
87 return self._missing
87 return self._missing
88
88
89 def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None):
89 def findcommonoutgoing(repo, other, onlyheads=None, force=False,
90 commoninc=None):
90 '''Return an outgoing instance to identify the nodes present in repo but
91 '''Return an outgoing instance to identify the nodes present in repo but
91 not in other.
92 not in other.
92
93
93 If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
94 If onlyheads is given, only nodes ancestral to nodes in onlyheads
94 are included. If you already know the local repo's heads, passing them in
95 (inclusive) are included. If you already know the local repo's heads,
95 onlyheads is faster than letting them be recomputed here.
96 passing them in onlyheads is faster than letting them be recomputed here.
96
97
97 If commoninc is given, it must the the result of a prior call to
98 If commoninc is given, it must the the result of a prior call to
98 findcommonincoming(repo, other, force) to avoid recomputing it here.'''
99 findcommonincoming(repo, other, force) to avoid recomputing it here.'''
@@ -12,7 +12,8 b' import cmdutil, encoding'
12 import ui as uimod
12 import ui as uimod
13
13
14 class request(object):
14 class request(object):
15 def __init__(self, args, ui=None, repo=None, fin=None, fout=None, ferr=None):
15 def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
16 ferr=None):
16 self.args = args
17 self.args = args
17 self.ui = ui
18 self.ui = ui
18 self.repo = repo
19 self.repo = repo
@@ -532,7 +533,8 b' def _checkshellalias(lui, ui, args):'
532
533
533 if cmd and util.safehasattr(fn, 'shell'):
534 if cmd and util.safehasattr(fn, 'shell'):
534 d = lambda: fn(ui, *args[1:])
535 d = lambda: fn(ui, *args[1:])
535 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
536 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d,
537 [], {})
536
538
537 restorecommands()
539 restorecommands()
538
540
@@ -680,7 +682,8 b' def _dispatch(req):'
680 return _dispatch(req)
682 return _dispatch(req)
681 if not path:
683 if not path:
682 raise error.RepoError(_("no repository found in '%s'"
684 raise error.RepoError(_("no repository found in '%s'"
683 " (.hg not found)") % os.getcwd())
685 " (.hg not found)")
686 % os.getcwd())
684 raise
687 raise
685 if repo:
688 if repo:
686 ui = repo.ui
689 ui = repo.ui
@@ -73,7 +73,8 b' class hgweb(object):'
73 self.repo = hg.repository(self.repo.ui, self.repo.root)
73 self.repo = hg.repository(self.repo.ui, self.repo.root)
74 self.maxchanges = int(self.config("web", "maxchanges", 10))
74 self.maxchanges = int(self.config("web", "maxchanges", 10))
75 self.stripecount = int(self.config("web", "stripes", 1))
75 self.stripecount = int(self.config("web", "stripes", 1))
76 self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
76 self.maxshortchanges = int(self.config("web", "maxshortchanges",
77 60))
77 self.maxfiles = int(self.config("web", "maxfiles", 10))
78 self.maxfiles = int(self.config("web", "maxfiles", 10))
78 self.allowpull = self.configbool("web", "allowpull", True)
79 self.allowpull = self.configbool("web", "allowpull", True)
79 encoding.encoding = self.config("web", "encoding",
80 encoding.encoding = self.config("web", "encoding",
@@ -280,7 +280,8 b' class localrepository(repo.repository):'
280 fp.write('\n')
280 fp.write('\n')
281 for name in names:
281 for name in names:
282 m = munge and munge(name) or name
282 m = munge and munge(name) or name
283 if self._tagscache.tagtypes and name in self._tagscache.tagtypes:
283 if (self._tagscache.tagtypes and
284 name in self._tagscache.tagtypes):
284 old = self.tags().get(name, nullid)
285 old = self.tags().get(name, nullid)
285 fp.write('%s %s\n' % (hex(old), m))
286 fp.write('%s %s\n' % (hex(old), m))
286 fp.write('%s %s\n' % (hex(node), m))
287 fp.write('%s %s\n' % (hex(node), m))
@@ -360,7 +361,8 b' class localrepository(repo.repository):'
360
361
361 @propertycache
362 @propertycache
362 def _tagscache(self):
363 def _tagscache(self):
363 '''Returns a tagscache object that contains various tags related caches.'''
364 '''Returns a tagscache object that contains various tags related
365 caches.'''
364
366
365 # This simplifies its cache management by having one decorated
367 # This simplifies its cache management by having one decorated
366 # function (this one) and the rest simply fetch things from it.
368 # function (this one) and the rest simply fetch things from it.
@@ -1173,7 +1175,8 b' class localrepository(repo.repository):'
1173 p1, p2 = self.dirstate.parents()
1175 p1, p2 = self.dirstate.parents()
1174 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
1176 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
1175 try:
1177 try:
1176 self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2)
1178 self.hook("precommit", throw=True, parent1=hookp1,
1179 parent2=hookp2)
1177 ret = self.commitctx(cctx, True)
1180 ret = self.commitctx(cctx, True)
1178 except:
1181 except:
1179 if edited:
1182 if edited:
@@ -1309,7 +1312,8 b' class localrepository(repo.repository):'
1309 def status(self, node1='.', node2=None, match=None,
1312 def status(self, node1='.', node2=None, match=None,
1310 ignored=False, clean=False, unknown=False,
1313 ignored=False, clean=False, unknown=False,
1311 listsubrepos=False):
1314 listsubrepos=False):
1312 """return status of files between two nodes or node and working directory
1315 """return status of files between two nodes or node and working
1316 directory.
1313
1317
1314 If node1 is None, use the first dirstate parent instead.
1318 If node1 is None, use the first dirstate parent instead.
1315 If node2 is None, compare node1 with working directory.
1319 If node2 is None, compare node1 with working directory.
@@ -1654,7 +1658,8 b' class localrepository(repo.repository):'
1654 # http: return remote's addchangegroup() or 0 for error
1658 # http: return remote's addchangegroup() or 0 for error
1655 ret = remote.unbundle(cg, remoteheads, 'push')
1659 ret = remote.unbundle(cg, remoteheads, 'push')
1656 else:
1660 else:
1657 # we return an integer indicating remote head count change
1661 # we return an integer indicating remote head count
1662 # change
1658 ret = remote.addchangegroup(cg, 'push', self.url())
1663 ret = remote.addchangegroup(cg, 'push', self.url())
1659
1664
1660 if ret:
1665 if ret:
@@ -1886,7 +1891,8 b' class localrepository(repo.repository):'
1886 for fname in sorted(changedfiles):
1891 for fname in sorted(changedfiles):
1887 filerevlog = self.file(fname)
1892 filerevlog = self.file(fname)
1888 if not len(filerevlog):
1893 if not len(filerevlog):
1889 raise util.Abort(_("empty or missing revlog for %s") % fname)
1894 raise util.Abort(_("empty or missing revlog for %s")
1895 % fname)
1890 fstate[0] = fname
1896 fstate[0] = fname
1891 fstate[1] = fnodes.pop(fname, {})
1897 fstate[1] = fnodes.pop(fname, {})
1892
1898
@@ -1986,7 +1992,8 b' class localrepository(repo.repository):'
1986 for fname in sorted(changedfiles):
1992 for fname in sorted(changedfiles):
1987 filerevlog = self.file(fname)
1993 filerevlog = self.file(fname)
1988 if not len(filerevlog):
1994 if not len(filerevlog):
1989 raise util.Abort(_("empty or missing revlog for %s") % fname)
1995 raise util.Abort(_("empty or missing revlog for %s")
1996 % fname)
1990 fstate[0] = fname
1997 fstate[0] = fname
1991 nodelist = gennodelst(filerevlog)
1998 nodelist = gennodelst(filerevlog)
1992 if nodelist:
1999 if nodelist:
@@ -2243,7 +2250,8 b' class localrepository(repo.repository):'
2243 (util.bytecount(total_bytes), elapsed,
2250 (util.bytecount(total_bytes), elapsed,
2244 util.bytecount(total_bytes / elapsed)))
2251 util.bytecount(total_bytes / elapsed)))
2245
2252
2246 # new requirements = old non-format requirements + new format-related
2253 # new requirements = old non-format requirements +
2254 # new format-related
2247 # requirements from the streamed-in repository
2255 # requirements from the streamed-in repository
2248 requirements.update(set(self.requirements) - self.supportedformats)
2256 requirements.update(set(self.requirements) - self.supportedformats)
2249 self._applyrequirements(requirements)
2257 self._applyrequirements(requirements)
@@ -126,8 +126,8 b' class manifest(revlog.revlog):'
126 addlist[start:end] = array.array('c', content)
126 addlist[start:end] = array.array('c', content)
127 else:
127 else:
128 del addlist[start:end]
128 del addlist[start:end]
129 return "".join(struct.pack(">lll", start, end, len(content)) + content
129 return "".join(struct.pack(">lll", start, end, len(content))
130 for start, end, content in x)
130 + content for start, end, content in x)
131
131
132 def checkforbidden(l):
132 def checkforbidden(l):
133 for f in l:
133 for f in l:
@@ -363,7 +363,8 b' def applyupdates(repo, action, wctx, mct'
363 removed += 1
363 removed += 1
364 elif m == "m": # merge
364 elif m == "m": # merge
365 if f == '.hgsubstate': # subrepo states need updating
365 if f == '.hgsubstate': # subrepo states need updating
366 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite)
366 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
367 overwrite)
367 continue
368 continue
368 f2, fd, flags, move = a[2:]
369 f2, fd, flags, move = a[2:]
369 repo.wopener.audit(fd)
370 repo.wopener.audit(fd)
@@ -858,7 +858,8 b' class hunk(object):'
858 self.lenb = int(self.lenb)
858 self.lenb = int(self.lenb)
859 self.starta = int(self.starta)
859 self.starta = int(self.starta)
860 self.startb = int(self.startb)
860 self.startb = int(self.startb)
861 diffhelpers.addlines(lr, self.hunk, self.lena, self.lenb, self.a, self.b)
861 diffhelpers.addlines(lr, self.hunk, self.lena, self.lenb, self.a,
862 self.b)
862 # if we hit eof before finishing out the hunk, the last line will
863 # if we hit eof before finishing out the hunk, the last line will
863 # be zero length. Lets try to fix it up.
864 # be zero length. Lets try to fix it up.
864 while len(self.hunk[-1]) == 0:
865 while len(self.hunk[-1]) == 0:
@@ -1620,8 +1621,9 b' def diff(repo, node1=None, node2=None, m'
1620 if opts.git or opts.upgrade:
1621 if opts.git or opts.upgrade:
1621 copy = copies.pathcopies(ctx1, ctx2)
1622 copy = copies.pathcopies(ctx1, ctx2)
1622
1623
1623 difffn = lambda opts, losedata: trydiff(repo, revs, ctx1, ctx2,
1624 difffn = (lambda opts, losedata:
1624 modified, added, removed, copy, getfilectx, opts, losedata, prefix)
1625 trydiff(repo, revs, ctx1, ctx2, modified, added, removed,
1626 copy, getfilectx, opts, losedata, prefix))
1625 if opts.upgrade and not opts.git:
1627 if opts.upgrade and not opts.git:
1626 try:
1628 try:
1627 def losedata(fn):
1629 def losedata(fn):
@@ -1862,7 +1864,8 b' def diffstat(lines, width=80, git=False)'
1862 countwidth, count, pluses, minuses))
1864 countwidth, count, pluses, minuses))
1863
1865
1864 if stats:
1866 if stats:
1865 output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
1867 output.append(_(' %d files changed, %d insertions(+), '
1868 '%d deletions(-)\n')
1866 % (len(stats), totaladds, totalremoves))
1869 % (len(stats), totaladds, totalremoves))
1867
1870
1868 return ''.join(output)
1871 return ''.join(output)
@@ -85,10 +85,10 b' def patches(a, bins):'
85 p1, p2, l = struct.unpack(">lll", m.read(12))
85 p1, p2, l = struct.unpack(">lll", m.read(12))
86 pull(new, frags, p1 - last) # what didn't change
86 pull(new, frags, p1 - last) # what didn't change
87 pull([], frags, p2 - p1) # what got deleted
87 pull([], frags, p2 - p1) # what got deleted
88 new.append((l, pos + 12)) # what got added
88 new.append((l, pos + 12)) # what got added
89 pos += l + 12
89 pos += l + 12
90 last = p2
90 last = p2
91 frags.extend(reversed(new)) # what was left at the end
91 frags.extend(reversed(new)) # what was left at the end
92
92
93 t = collect(b2, frags)
93 t = collect(b2, frags)
94
94
@@ -108,7 +108,8 b' def tokenize(program):'
108 pos += 1
108 pos += 1
109 else:
109 else:
110 raise error.ParseError(_("unterminated string"), s)
110 raise error.ParseError(_("unterminated string"), s)
111 elif c.isalnum() or c in '._' or ord(c) > 127: # gather up a symbol/keyword
111 # gather up a symbol/keyword
112 elif c.isalnum() or c in '._' or ord(c) > 127:
112 s = pos
113 s = pos
113 pos += 1
114 pos += 1
114 while pos < l: # find end of symbol
115 while pos < l: # find end of symbol
@@ -257,7 +258,8 b' def _firstancestors(repo, subset, x):'
257
258
258 def ancestorspec(repo, subset, x, n):
259 def ancestorspec(repo, subset, x, n):
259 """``set~n``
260 """``set~n``
260 Changesets that are the Nth ancestor (first parents only) of a changeset in set.
261 Changesets that are the Nth ancestor (first parents only) of a changeset
262 in set.
261 """
263 """
262 try:
264 try:
263 n = int(n[1])
265 n = int(n[1])
@@ -141,8 +141,9 b' class pathauditor(object):'
141 elif (stat.S_ISDIR(st.st_mode) and
141 elif (stat.S_ISDIR(st.st_mode) and
142 os.path.isdir(os.path.join(curpath, '.hg'))):
142 os.path.isdir(os.path.join(curpath, '.hg'))):
143 if not self.callback or not self.callback(curpath):
143 if not self.callback or not self.callback(curpath):
144 raise util.Abort(_("path '%s' is inside nested repo %r") %
144 raise util.Abort(_("path '%s' is inside nested "
145 (path, prefix))
145 "repo %r")
146 % (path, prefix))
146 prefixes.append(normprefix)
147 prefixes.append(normprefix)
147 parts.pop()
148 parts.pop()
148 normparts.pop()
149 normparts.pop()
@@ -654,8 +655,9 b' def addremove(repo, pats=[], opts={}, dr'
654 unknown.append(abs)
655 unknown.append(abs)
655 if repo.ui.verbose or not exact:
656 if repo.ui.verbose or not exact:
656 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
657 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
657 elif repo.dirstate[abs] != 'r' and (not good or not os.path.lexists(target)
658 elif (repo.dirstate[abs] != 'r' and
658 or (os.path.isdir(target) and not os.path.islink(target))):
659 (not good or not os.path.lexists(target) or
660 (os.path.isdir(target) and not os.path.islink(target)))):
659 deleted.append(abs)
661 deleted.append(abs)
660 if repo.ui.verbose or not exact:
662 if repo.ui.verbose or not exact:
661 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
663 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
@@ -764,8 +766,9 b' def readrequires(opener, supported):'
764 missings.append(r)
766 missings.append(r)
765 missings.sort()
767 missings.sort()
766 if missings:
768 if missings:
767 raise error.RequirementError(_("unknown repository format: "
769 raise error.RequirementError(
768 "requires features '%s' (upgrade Mercurial)") % "', '".join(missings))
770 _("unknown repository format: requires features '%s' (upgrade "
771 "Mercurial)") % "', '".join(missings))
769 return requirements
772 return requirements
770
773
771 class filecacheentry(object):
774 class filecacheentry(object):
@@ -134,11 +134,16 b' def findcommonheads(ui, local, remote,'
134 return (ownheadhashes, True, srvheadhashes,)
134 return (ownheadhashes, True, srvheadhashes,)
135
135
136 # full blown discovery
136 # full blown discovery
137 undecided = dag.nodeset() # own nodes where I don't know if remote knows them
138 common = set() # own nodes I know we both know
139 missing = set() # own nodes I know remote lacks
140
137
141 # treat remote heads (and maybe own heads) as a first implicit sample response
138 # own nodes where I don't know if remote knows them
139 undecided = dag.nodeset()
140 # own nodes I know we both know
141 common = set()
142 # own nodes I know remote lacks
143 missing = set()
144
145 # treat remote heads (and maybe own heads) as a first implicit sample
146 # response
142 common.update(dag.ancestorset(srvheads))
147 common.update(dag.ancestorset(srvheads))
143 undecided.difference_update(common)
148 undecided.difference_update(common)
144
149
@@ -44,7 +44,8 b' def _findsimilarmatches(repo, added, rem'
44 '''
44 '''
45 copies = {}
45 copies = {}
46 for i, r in enumerate(removed):
46 for i, r in enumerate(removed):
47 repo.ui.progress(_('searching for similar files'), i, total=len(removed))
47 repo.ui.progress(_('searching for similar files'), i,
48 total=len(removed))
48
49
49 # lazily load text
50 # lazily load text
50 @util.cachefunc
51 @util.cachefunc
@@ -222,7 +222,8 b' class Merge3Text(object):'
222 # section a[0:ia] has been disposed of, etc
222 # section a[0:ia] has been disposed of, etc
223 iz = ia = ib = 0
223 iz = ia = ib = 0
224
224
225 for zmatch, zend, amatch, aend, bmatch, bend in self.find_sync_regions():
225 for region in self.find_sync_regions():
226 zmatch, zend, amatch, aend, bmatch, bend = region
226 #print 'match base [%d:%d]' % (zmatch, zend)
227 #print 'match base [%d:%d]' % (zmatch, zend)
227
228
228 matchlen = zend - zmatch
229 matchlen = zend - zmatch
@@ -86,7 +86,8 b' class sshrepository(wireproto.wirereposi'
86 lines.append(l)
86 lines.append(l)
87 max_noise -= 1
87 max_noise -= 1
88 else:
88 else:
89 self._abort(error.RepoError(_("no suitable response from remote hg")))
89 self._abort(error.RepoError(_('no suitable response from '
90 'remote hg')))
90
91
91 self.capabilities = set()
92 self.capabilities = set()
92 for l in reversed(lines):
93 for l in reversed(lines):
@@ -200,7 +200,8 b' def _updateprompt(ui, sub, dirty, local,'
200 'use (l)ocal source (%s) or (r)emote source (%s)?\n')
200 'use (l)ocal source (%s) or (r)emote source (%s)?\n')
201 % (subrelpath(sub), local, remote))
201 % (subrelpath(sub), local, remote))
202 else:
202 else:
203 msg = (_(' subrepository sources for %s differ (in checked out version)\n'
203 msg = (_(' subrepository sources for %s differ (in checked out '
204 'version)\n'
204 'use (l)ocal source (%s) or (r)emote source (%s)?\n')
205 'use (l)ocal source (%s) or (r)emote source (%s)?\n')
205 % (subrelpath(sub), local, remote))
206 % (subrelpath(sub), local, remote))
206 return ui.promptchoice(msg, (_('&Local'), _('&Remote')), 0)
207 return ui.promptchoice(msg, (_('&Local'), _('&Remote')), 0)
@@ -498,8 +499,9 b' class hgsubrepo(abstractsubrepo):'
498 % (subrelpath(self), srcurl))
499 % (subrelpath(self), srcurl))
499 parentrepo = self._repo._subparent
500 parentrepo = self._repo._subparent
500 shutil.rmtree(self._repo.path)
501 shutil.rmtree(self._repo.path)
501 other, self._repo = hg.clone(self._repo._subparent.ui, {}, other,
502 other, self._repo = hg.clone(self._repo._subparent.ui, {},
502 self._repo.root, update=False)
503 other, self._repo.root,
504 update=False)
503 self._initrepo(parentrepo, source, create=True)
505 self._initrepo(parentrepo, source, create=True)
504 else:
506 else:
505 self._repo.ui.status(_('pulling subrepo %s from %s\n')
507 self._repo.ui.status(_('pulling subrepo %s from %s\n')
@@ -680,7 +680,8 b' class ui(object):'
680 printed.'''
680 printed.'''
681 if self.tracebackflag:
681 if self.tracebackflag:
682 if exc:
682 if exc:
683 traceback.print_exception(exc[0], exc[1], exc[2], file=self.ferr)
683 traceback.print_exception(exc[0], exc[1], exc[2],
684 file=self.ferr)
684 else:
685 else:
685 traceback.print_exc(file=self.ferr)
686 traceback.print_exc(file=self.ferr)
686 return self.tracebackflag
687 return self.tracebackflag
@@ -377,7 +377,8 b' if has_https:'
377 keyfile = self.auth['key']
377 keyfile = self.auth['key']
378 certfile = self.auth['cert']
378 certfile = self.auth['cert']
379
379
380 conn = httpsconnection(host, port, keyfile, certfile, *args, **kwargs)
380 conn = httpsconnection(host, port, keyfile, certfile, *args,
381 **kwargs)
381 conn.ui = self.ui
382 conn.ui = self.ui
382 return conn
383 return conn
383
384
@@ -24,9 +24,9 b' class future(object):'
24 class batcher(object):
24 class batcher(object):
25 '''base class for batches of commands submittable in a single request
25 '''base class for batches of commands submittable in a single request
26
26
27 All methods invoked on instances of this class are simply queued and return a
27 All methods invoked on instances of this class are simply queued and
28 a future for the result. Once you call submit(), all the queued calls are
28 return a a future for the result. Once you call submit(), all the queued
29 performed and the results set in their respective futures.
29 calls are performed and the results set in their respective futures.
30 '''
30 '''
31 def __init__(self):
31 def __init__(self):
32 self.calls = []
32 self.calls = []
@@ -51,7 +51,8 b' class localbatch(batcher):'
51 class remotebatch(batcher):
51 class remotebatch(batcher):
52 '''batches the queued calls; uses as few roundtrips as possible'''
52 '''batches the queued calls; uses as few roundtrips as possible'''
53 def __init__(self, remote):
53 def __init__(self, remote):
54 '''remote must support _submitbatch(encbatch) and _submitone(op, encargs)'''
54 '''remote must support _submitbatch(encbatch) and
55 _submitone(op, encargs)'''
55 batcher.__init__(self)
56 batcher.__init__(self)
56 self.remote = remote
57 self.remote = remote
57 def submit(self):
58 def submit(self):
@@ -97,14 +98,14 b' def batchable(f):'
97 encresref = future()
98 encresref = future()
98 # Return encoded arguments and future:
99 # Return encoded arguments and future:
99 yield encargs, encresref
100 yield encargs, encresref
100 # Assuming the future to be filled with the result from the batched request
101 # Assuming the future to be filled with the result from the batched
101 # now. Decode it:
102 # request now. Decode it:
102 yield decode(encresref.value)
103 yield decode(encresref.value)
103
104
104 The decorator returns a function which wraps this coroutine as a plain method,
105 The decorator returns a function which wraps this coroutine as a plain
105 but adds the original method as an attribute called "batchable", which is
106 method, but adds the original method as an attribute called "batchable",
106 used by remotebatch to split the call into separate encoding and decoding
107 which is used by remotebatch to split the call into separate encoding and
107 phases.
108 decoding phases.
108 '''
109 '''
109 def plain(*args, **opts):
110 def plain(*args, **opts):
110 batchable = f(*args, **opts)
111 batchable = f(*args, **opts)
@@ -39,7 +39,8 b' except:'
39 # The base IronPython distribution (as of 2.7.1) doesn't support bz2
39 # The base IronPython distribution (as of 2.7.1) doesn't support bz2
40 isironpython = False
40 isironpython = False
41 try:
41 try:
42 isironpython = platform.python_implementation().lower().find("ironpython") != -1
42 isironpython = (platform.python_implementation()
43 .lower().find("ironpython") != -1)
43 except:
44 except:
44 pass
45 pass
45
46
@@ -211,10 +212,12 b' class hgbuild(build):'
211 # Insert hgbuildmo first so that files in mercurial/locale/ are found
212 # Insert hgbuildmo first so that files in mercurial/locale/ are found
212 # when build_py is run next.
213 # when build_py is run next.
213 sub_commands = [('build_mo', None),
214 sub_commands = [('build_mo', None),
214 # We also need build_ext before build_py. Otherwise, when 2to3 is called (in
215
215 # build_py), it will not find osutil & friends, thinking that those modules are
216 # We also need build_ext before build_py. Otherwise, when 2to3 is
216 # global and, consequently, making a mess, now that all module imports are
217 # called (in build_py), it will not find osutil & friends,
217 # global.
218 # thinking that those modules are global and, consequently, making
219 # a mess, now that all module imports are global.
220
218 ('build_ext', build.has_ext_modules),
221 ('build_ext', build.has_ext_modules),
219 ] + build.sub_commands
222 ] + build.sub_commands
220
223
@@ -292,7 +295,8 b' class hgbuildpy(build_py):'
292 self.distribution.ext_modules = []
295 self.distribution.ext_modules = []
293 else:
296 else:
294 if not os.path.exists(os.path.join(get_python_inc(), 'Python.h')):
297 if not os.path.exists(os.path.join(get_python_inc(), 'Python.h')):
295 raise SystemExit("Python headers are required to build Mercurial")
298 raise SystemExit('Python headers are required to build '
299 'Mercurial')
296
300
297 def find_modules(self):
301 def find_modules(self):
298 modules = build_py.find_modules(self)
302 modules = build_py.find_modules(self)
@@ -165,7 +165,8 b' def has_svn_bindings():'
165 return False
165 return False
166
166
167 def has_p4():
167 def has_p4():
168 return matchoutput('p4 -V', r'Rev\. P4/') and matchoutput('p4d -V', r'Rev\. P4D/')
168 return (matchoutput('p4 -V', r'Rev\. P4/') and
169 matchoutput('p4d -V', r'Rev\. P4D/'))
169
170
170 def has_symlink():
171 def has_symlink():
171 if not hasattr(os, "symlink"):
172 if not hasattr(os, "symlink"):
@@ -8,16 +8,10 b''
8 $ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
8 $ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
9
9
10 $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0 || true
10 $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0 || true
11 contrib/check-code.py:0:
12 > # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
13 warning: line over 80 characters
14 contrib/perf.py:0:
11 contrib/perf.py:0:
15 > except:
12 > except:
16 warning: naked except clause
13 warning: naked except clause
17 contrib/perf.py:0:
14 contrib/perf.py:0:
18 > #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False, False))))
19 warning: line over 80 characters
20 contrib/perf.py:0:
21 > except:
15 > except:
22 warning: naked except clause
16 warning: naked except clause
23 contrib/setup3k.py:0:
17 contrib/setup3k.py:0:
@@ -34,18 +28,6 b''
34 contrib/shrink-revlog.py:0:
28 contrib/shrink-revlog.py:0:
35 > except:
29 > except:
36 warning: naked except clause
30 warning: naked except clause
37 doc/gendoc.py:0:
38 > "together with Mercurial. Help for other extensions is available "
39 warning: line over 80 characters
40 hgext/bugzilla.py:0:
41 > raise util.Abort(_('cannot find bugzilla user id for %s or %s') %
42 warning: line over 80 characters
43 hgext/bugzilla.py:0:
44 > bzdir = self.ui.config('bugzilla', 'bzdir', '/var/www/html/bugzilla')
45 warning: line over 80 characters
46 hgext/convert/__init__.py:0:
47 > ('', 'ancestors', '', _('show current changeset in ancestor branches')),
48 warning: line over 80 characters
49 hgext/convert/bzr.py:0:
31 hgext/convert/bzr.py:0:
50 > except:
32 > except:
51 warning: naked except clause
33 warning: naked except clause
@@ -59,12 +41,6 b''
59 hgext/convert/convcmd.py:0:
41 hgext/convert/convcmd.py:0:
60 > except:
42 > except:
61 warning: naked except clause
43 warning: naked except clause
62 hgext/convert/cvs.py:0:
63 > # /1 :pserver:user@example.com:2401/cvsroot/foo Ah<Z
64 warning: line over 80 characters
65 hgext/convert/cvsps.py:0:
66 > assert len(branches) == 1, 'unknown branch: %s' % e.mergepoint
67 warning: line over 80 characters
68 hgext/convert/cvsps.py:0:
44 hgext/convert/cvsps.py:0:
69 > ui.write('Ancestors: %s\n' % (','.join(r)))
45 > ui.write('Ancestors: %s\n' % (','.join(r)))
70 warning: unwrapped ui message
46 warning: unwrapped ui message
@@ -104,12 +80,6 b''
104 hgext/convert/git.py:0:
80 hgext/convert/git.py:0:
105 > except:
81 > except:
106 warning: naked except clause
82 warning: naked except clause
107 hgext/convert/git.py:0:
108 > fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
109 warning: line over 80 characters
110 hgext/convert/hg.py:0:
111 > # detect missing revlogs and abort on errors or populate self.ignored
112 warning: line over 80 characters
113 hgext/convert/hg.py:0:
83 hgext/convert/hg.py:0:
114 > except:
84 > except:
115 warning: naked except clause
85 warning: naked except clause
@@ -124,27 +94,11 b''
124 > except:
94 > except:
125 warning: naked except clause
95 warning: naked except clause
126 hgext/convert/subversion.py:0:
96 hgext/convert/subversion.py:0:
127 > raise util.Abort(_('svn: branch has no revision %s') % to_revnum)
128 warning: line over 80 characters
129 hgext/convert/subversion.py:0:
130 > except:
97 > except:
131 warning: naked except clause
98 warning: naked except clause
132 hgext/convert/subversion.py:0:
99 hgext/convert/subversion.py:0:
133 > args = [self.baseurl, relpaths, start, end, limit, discover_changed_paths,
134 warning: line over 80 characters
135 hgext/convert/subversion.py:0:
136 > self.trunkname = self.ui.config('convert', 'svn.trunk', 'trunk').strip('/')
137 warning: line over 80 characters
138 hgext/convert/subversion.py:0:
139 > except:
100 > except:
140 warning: naked except clause
101 warning: naked except clause
141 hgext/convert/subversion.py:0:
142 > def get_log_child(fp, url, paths, start, end, limit=0, discover_changed_paths=True,
143 warning: line over 80 characters
144 hgext/eol.py:0:
145 > if ui.configbool('eol', 'fix-trailing-newline', False) and s and s[-1] != '\n':
146 warning: line over 80 characters
147 warning: line over 80 characters
148 hgext/gpg.py:0:
102 hgext/gpg.py:0:
149 > except:
103 > except:
150 warning: naked except clause
104 warning: naked except clause
@@ -152,9 +106,6 b''
152 > except:
106 > except:
153 warning: naked except clause
107 warning: naked except clause
154 hgext/hgk.py:0:
108 hgext/hgk.py:0:
155 > ui.write("%s%s\n" % (prefix, description.replace('\n', nlprefix).strip()))
156 warning: line over 80 characters
157 hgext/hgk.py:0:
158 > ui.write("parent %s\n" % p)
109 > ui.write("parent %s\n" % p)
159 warning: unwrapped ui message
110 warning: unwrapped ui message
160 hgext/hgk.py:0:
111 hgext/hgk.py:0:
@@ -173,18 +124,8 b''
173 > ui.write("revision %d\n" % ctx.rev())
124 > ui.write("revision %d\n" % ctx.rev())
174 warning: unwrapped ui message
125 warning: unwrapped ui message
175 hgext/hgk.py:0:
126 hgext/hgk.py:0:
176 > ui.write("tree %s\n" % short(ctx.changeset()[0])) # use ctx.node() instead ??
127 > ui.write("tree %s\n" % short(ctx.changeset()[0]))
177 warning: line over 80 characters
178 warning: unwrapped ui message
128 warning: unwrapped ui message
179 hgext/highlight/__init__.py:0:
180 > extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight)
181 warning: line over 80 characters
182 hgext/highlight/__init__.py:0:
183 > return ['/* pygments_style = %s */\n\n' % pg_style, fmter.get_style_defs('')]
184 warning: line over 80 characters
185 hgext/inotify/__init__.py:0:
186 > if self._inotifyon and not ignored and not subrepos and not self._dirty:
187 warning: line over 80 characters
188 hgext/inotify/server.py:0:
129 hgext/inotify/server.py:0:
189 > except:
130 > except:
190 warning: naked except clause
131 warning: naked except clause
@@ -195,15 +136,6 b''
195 > ui.note("hg ci -m '%s'\n" % msg)
136 > ui.note("hg ci -m '%s'\n" % msg)
196 warning: unwrapped ui message
137 warning: unwrapped ui message
197 hgext/mq.py:0:
138 hgext/mq.py:0:
198 > raise util.Abort(_("cannot push --exact with applied patches"))
199 warning: line over 80 characters
200 hgext/mq.py:0:
201 > raise util.Abort(_("cannot use --exact and --move together"))
202 warning: line over 80 characters
203 hgext/mq.py:0:
204 > self.ui.warn(_('Tag %s overrides mq patch of the same name\n')
205 warning: line over 80 characters
206 hgext/mq.py:0:
207 > except:
139 > except:
208 warning: naked except clause
140 warning: naked except clause
209 warning: naked except clause
141 warning: naked except clause
@@ -214,32 +146,11 b''
214 warning: naked except clause
146 warning: naked except clause
215 warning: naked except clause
147 warning: naked except clause
216 hgext/mq.py:0:
148 hgext/mq.py:0:
217 > raise util.Abort(_('cannot mix -l/--list with options or arguments'))
218 warning: line over 80 characters
219 hgext/mq.py:0:
220 > raise util.Abort(_('qfold cannot fold already applied patch %s') % p)
221 warning: line over 80 characters
222 hgext/mq.py:0:
223 > ('U', 'noupdate', None, _('do not update the new working directories')),
224 warning: line over 80 characters
225 hgext/mq.py:0:
226 > ('e', 'exact', None, _('apply the target patch to its recorded parent')),
227 warning: line over 80 characters
228 hgext/mq.py:0:
229 > except:
149 > except:
230 warning: naked except clause
150 warning: naked except clause
231 hgext/mq.py:0:
151 hgext/mq.py:0:
232 > ui.write("mq: %s\n" % ', '.join(m))
152 > ui.write("mq: %s\n" % ', '.join(m))
233 warning: unwrapped ui message
153 warning: unwrapped ui message
234 hgext/mq.py:0:
235 > repo.mq.qseries(repo, missing=opts.get('missing'), summary=opts.get('summary'))
236 warning: line over 80 characters
237 hgext/notify.py:0:
238 > ui.note(_('notify: suppressing notification for merge %d:%s\n') %
239 warning: line over 80 characters
240 hgext/patchbomb.py:0:
241 > binnode, seqno=idx, total=total)
242 warning: line over 80 characters
243 hgext/patchbomb.py:0:
154 hgext/patchbomb.py:0:
244 > except:
155 > except:
245 warning: naked except clause
156 warning: naked except clause
@@ -247,39 +158,12 b''
247 > ui.write('Subject: %s\n' % subj)
158 > ui.write('Subject: %s\n' % subj)
248 warning: unwrapped ui message
159 warning: unwrapped ui message
249 hgext/patchbomb.py:0:
160 hgext/patchbomb.py:0:
250 > p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', opts.get('test'))
251 warning: line over 80 characters
252 hgext/patchbomb.py:0:
253 > ui.write('From: %s\n' % sender)
161 > ui.write('From: %s\n' % sender)
254 warning: unwrapped ui message
162 warning: unwrapped ui message
255 hgext/record.py:0:
256 > ignoreblanklines=opts.get('ignore_blank_lines'))
257 warning: line over 80 characters
258 hgext/record.py:0:
259 > ignorewsamount=opts.get('ignore_space_change'),
260 warning: line over 80 characters
261 hgext/zeroconf/__init__.py:0:
262 > publish(name, desc, path, util.getport(u.config("web", "port", 8000)))
263 warning: line over 80 characters
264 hgext/zeroconf/__init__.py:0:
163 hgext/zeroconf/__init__.py:0:
265 > except:
164 > except:
266 warning: naked except clause
165 warning: naked except clause
267 warning: naked except clause
166 warning: naked except clause
268 mercurial/bundlerepo.py:0:
269 > is a bundlerepo for the obtained bundle when the original "other" is remote.
270 warning: line over 80 characters
271 mercurial/bundlerepo.py:0:
272 > "local" is a local repo from which to obtain the actual incoming changesets; it
273 warning: line over 80 characters
274 mercurial/bundlerepo.py:0:
275 > tmp = discovery.findcommonincoming(repo, other, heads=onlyheads, force=force)
276 warning: line over 80 characters
277 mercurial/commands.py:0:
278 > " size " + basehdr + " link p1 p2 nodeid\n")
279 warning: line over 80 characters
280 mercurial/commands.py:0:
281 > raise util.Abort('cannot use localheads with old style discovery')
282 warning: line over 80 characters
283 mercurial/commands.py:0:
167 mercurial/commands.py:0:
284 > ui.note('branch %s\n' % data)
168 > ui.note('branch %s\n' % data)
285 warning: unwrapped ui message
169 warning: unwrapped ui message
@@ -293,18 +177,9 b''
293 > ui.write("unpruned common: %s\n" % " ".join([short(n)
177 > ui.write("unpruned common: %s\n" % " ".join([short(n)
294 warning: unwrapped ui message
178 warning: unwrapped ui message
295 mercurial/commands.py:0:
179 mercurial/commands.py:0:
296 > yield 'n', (r, list(set(p for p in cl.parentrevs(r) if p != -1)))
297 warning: line over 80 characters
298 mercurial/commands.py:0:
299 > yield 'n', (r, list(set(p for p in rlog.parentrevs(r) if p != -1)))
300 warning: line over 80 characters
301 mercurial/commands.py:0:
302 > except:
180 > except:
303 warning: naked except clause
181 warning: naked except clause
304 mercurial/commands.py:0:
182 mercurial/commands.py:0:
305 > ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to merge)\n"))
306 warning: line over 80 characters
307 mercurial/commands.py:0:
308 > ui.write("format: id, p1, p2, cset, delta base, len(delta)\n")
183 > ui.write("format: id, p1, p2, cset, delta base, len(delta)\n")
309 warning: unwrapped ui message
184 warning: unwrapped ui message
310 mercurial/commands.py:0:
185 mercurial/commands.py:0:
@@ -314,17 +189,7 b''
314 > ui.write("remote is subset\n")
189 > ui.write("remote is subset\n")
315 warning: unwrapped ui message
190 warning: unwrapped ui message
316 mercurial/commands.py:0:
191 mercurial/commands.py:0:
317 > ui.write(' other : ' + fmt2 % pcfmt(numoprev, numprev))
192 > ui.write('deltas against other : ' + fmt % pcfmt(numother,
318 warning: line over 80 characters
319 mercurial/commands.py:0:
320 > ui.write(' where prev = p1 : ' + fmt2 % pcfmt(nump1prev, numprev))
321 warning: line over 80 characters
322 mercurial/commands.py:0:
323 > ui.write(' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev))
324 warning: line over 80 characters
325 mercurial/commands.py:0:
326 > ui.write('deltas against other : ' + fmt % pcfmt(numother, numdeltas))
327 warning: line over 80 characters
328 warning: unwrapped ui message
193 warning: unwrapped ui message
329 mercurial/commands.py:0:
194 mercurial/commands.py:0:
330 > ui.write('deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas))
195 > ui.write('deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas))
@@ -336,9 +201,6 b''
336 > except:
201 > except:
337 warning: naked except clause
202 warning: naked except clause
338 mercurial/commands.py:0:
203 mercurial/commands.py:0:
339 > revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
340 warning: line over 80 characters
341 mercurial/commands.py:0:
342 > ui.write("common heads: %s\n" % " ".join([short(n) for n in common]))
204 > ui.write("common heads: %s\n" % " ".join([short(n) for n in common]))
343 warning: unwrapped ui message
205 warning: unwrapped ui message
344 mercurial/commands.py:0:
206 mercurial/commands.py:0:
@@ -354,12 +216,6 b''
354 > ui.write('uncompressed data size (min/max/avg) : %d / %d / %d\n'
216 > ui.write('uncompressed data size (min/max/avg) : %d / %d / %d\n'
355 warning: unwrapped ui message
217 warning: unwrapped ui message
356 mercurial/commands.py:0:
218 mercurial/commands.py:0:
357 > Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
358 warning: line over 80 characters
359 mercurial/commands.py:0:
360 > remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
361 warning: line over 80 characters
362 mercurial/commands.py:0:
363 > ui.write("digraph G {\n")
219 > ui.write("digraph G {\n")
364 warning: unwrapped ui message
220 warning: unwrapped ui message
365 mercurial/commands.py:0:
221 mercurial/commands.py:0:
@@ -402,48 +258,15 b''
402 mercurial/commands.py:0:
258 mercurial/commands.py:0:
403 > ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
259 > ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
404 warning: unwrapped ui message
260 warning: unwrapped ui message
405 mercurial/commandserver.py:0:
406 > # the ui here is really the repo ui so take its baseui so we don't end up
407 warning: line over 80 characters
408 mercurial/context.py:0:
409 > return self._manifestdelta[path], self._manifestdelta.flags(path)
410 warning: line over 80 characters
411 mercurial/dagparser.py:0:
412 > raise util.Abort(_("invalid character in dag description: %s...") % s)
413 warning: line over 80 characters
414 mercurial/dagparser.py:0:
415 > >>> dagtext([('n', (0, [-1])), ('C', 'my command line'), ('n', (1, [0]))])
416 warning: line over 80 characters
417 mercurial/dirstate.py:0:
418 > if not st is None and not getkind(st.st_mode) in (regkind, lnkkind):
419 warning: line over 80 characters
420 mercurial/discovery.py:0:
421 > If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
422 warning: line over 80 characters
423 mercurial/discovery.py:0:
424 > def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None):
425 warning: line over 80 characters
426 mercurial/dispatch.py:0:
427 > " (.hg not found)") % os.getcwd())
428 warning: line over 80 characters
429 mercurial/dispatch.py:0:
261 mercurial/dispatch.py:0:
430 > except:
262 > except:
431 warning: naked except clause
263 warning: naked except clause
432 mercurial/dispatch.py:0:
264 mercurial/dispatch.py:0:
433 > return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
434 warning: line over 80 characters
435 mercurial/dispatch.py:0:
436 > def __init__(self, args, ui=None, repo=None, fin=None, fout=None, ferr=None):
437 warning: line over 80 characters
438 mercurial/dispatch.py:0:
439 > except:
265 > except:
440 warning: naked except clause
266 warning: naked except clause
441 mercurial/hg.py:0:
267 mercurial/hg.py:0:
442 > except:
268 > except:
443 warning: naked except clause
269 warning: naked except clause
444 mercurial/hgweb/hgweb_mod.py:0:
445 > self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
446 warning: line over 80 characters
447 mercurial/keepalive.py:0:
270 mercurial/keepalive.py:0:
448 > except:
271 > except:
449 warning: naked except clause
272 warning: naked except clause
@@ -451,105 +274,23 b''
451 > except:
274 > except:
452 warning: naked except clause
275 warning: naked except clause
453 mercurial/localrepo.py:0:
276 mercurial/localrepo.py:0:
454 > # we return an integer indicating remote head count change
455 warning: line over 80 characters
456 mercurial/localrepo.py:0:
457 > raise util.Abort(_("empty or missing revlog for %s") % fname)
458 warning: line over 80 characters
459 warning: line over 80 characters
460 mercurial/localrepo.py:0:
461 > if self._tagscache.tagtypes and name in self._tagscache.tagtypes:
462 warning: line over 80 characters
463 mercurial/localrepo.py:0:
464 > self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2)
465 warning: line over 80 characters
466 mercurial/localrepo.py:0:
467 > # new requirements = old non-format requirements + new format-related
468 warning: line over 80 characters
469 mercurial/localrepo.py:0:
470 > except:
277 > except:
471 warning: naked except clause
278 warning: naked except clause
472 mercurial/localrepo.py:0:
473 > """return status of files between two nodes or node and working directory
474 warning: line over 80 characters
475 mercurial/localrepo.py:0:
476 > '''Returns a tagscache object that contains various tags related caches.'''
477 warning: line over 80 characters
478 mercurial/manifest.py:0:
479 > return "".join(struct.pack(">lll", start, end, len(content)) + content
480 warning: line over 80 characters
481 mercurial/merge.py:0:
482 > subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite)
483 warning: line over 80 characters
484 mercurial/patch.py:0:
485 > modified, added, removed, copy, getfilectx, opts, losedata, prefix)
486 warning: line over 80 characters
487 mercurial/patch.py:0:
488 > diffhelpers.addlines(lr, self.hunk, self.lena, self.lenb, self.a, self.b)
489 warning: line over 80 characters
490 mercurial/patch.py:0:
491 > output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
492 warning: line over 80 characters
493 mercurial/patch.py:0:
279 mercurial/patch.py:0:
494 > except:
280 > except:
495 warning: naked except clause
281 warning: naked except clause
496 mercurial/pure/mpatch.py:0:
497 > frags.extend(reversed(new)) # what was left at the end
498 warning: line over 80 characters
499 mercurial/repair.py:0:
282 mercurial/repair.py:0:
500 > except:
283 > except:
501 warning: naked except clause
284 warning: naked except clause
502 mercurial/repair.py:0:
285 mercurial/repair.py:0:
503 > except:
286 > except:
504 warning: naked except clause
287 warning: naked except clause
505 mercurial/revset.py:0:
506 > elif c.isalnum() or c in '._' or ord(c) > 127: # gather up a symbol/keyword
507 warning: line over 80 characters
508 mercurial/revset.py:0:
509 > Changesets that are the Nth ancestor (first parents only) of a changeset in set.
510 warning: line over 80 characters
511 mercurial/scmutil.py:0:
512 > raise util.Abort(_("path '%s' is inside nested repo %r") %
513 warning: line over 80 characters
514 mercurial/scmutil.py:0:
515 > "requires features '%s' (upgrade Mercurial)") % "', '".join(missings))
516 warning: line over 80 characters
517 mercurial/scmutil.py:0:
518 > elif repo.dirstate[abs] != 'r' and (not good or not os.path.lexists(target)
519 warning: line over 80 characters
520 mercurial/setdiscovery.py:0:
521 > # treat remote heads (and maybe own heads) as a first implicit sample response
522 warning: line over 80 characters
523 mercurial/setdiscovery.py:0:
524 > undecided = dag.nodeset() # own nodes where I don't know if remote knows them
525 warning: line over 80 characters
526 mercurial/similar.py:0:
527 > repo.ui.progress(_('searching for similar files'), i, total=len(removed))
528 warning: line over 80 characters
529 mercurial/simplemerge.py:0:
530 > for zmatch, zend, amatch, aend, bmatch, bend in self.find_sync_regions():
531 warning: line over 80 characters
532 mercurial/sshrepo.py:0:
533 > self._abort(error.RepoError(_("no suitable response from remote hg")))
534 warning: line over 80 characters
535 mercurial/sshrepo.py:0:
288 mercurial/sshrepo.py:0:
536 > except:
289 > except:
537 warning: naked except clause
290 warning: naked except clause
538 mercurial/subrepo.py:0:
539 > other, self._repo = hg.clone(self._repo._subparent.ui, {}, other,
540 warning: line over 80 characters
541 mercurial/subrepo.py:0:
542 > msg = (_(' subrepository sources for %s differ (in checked out version)\n'
543 warning: line over 80 characters
544 mercurial/transaction.py:0:
291 mercurial/transaction.py:0:
545 > except:
292 > except:
546 warning: naked except clause
293 warning: naked except clause
547 mercurial/ui.py:0:
548 > traceback.print_exception(exc[0], exc[1], exc[2], file=self.ferr)
549 warning: line over 80 characters
550 mercurial/url.py:0:
551 > conn = httpsconnection(host, port, keyfile, certfile, *args, **kwargs)
552 warning: line over 80 characters
553 mercurial/util.py:0:
294 mercurial/util.py:0:
554 > except:
295 > except:
555 warning: naked except clause
296 warning: naked except clause
@@ -562,35 +303,14 b''
562 mercurial/verify.py:0:
303 mercurial/verify.py:0:
563 > except:
304 > except:
564 warning: naked except clause
305 warning: naked except clause
565 mercurial/wireproto.py:0:
566 > # Assuming the future to be filled with the result from the batched request
567 warning: line over 80 characters
568 mercurial/wireproto.py:0:
569 > '''remote must support _submitbatch(encbatch) and _submitone(op, encargs)'''
570 warning: line over 80 characters
571 mercurial/wireproto.py:0:
572 > All methods invoked on instances of this class are simply queued and return a
573 warning: line over 80 characters
574 mercurial/wireproto.py:0:
575 > The decorator returns a function which wraps this coroutine as a plain method,
576 warning: line over 80 characters
577 setup.py:0:
578 > raise SystemExit("Python headers are required to build Mercurial")
579 warning: line over 80 characters
580 setup.py:0:
306 setup.py:0:
581 > except:
307 > except:
582 warning: naked except clause
308 warning: naked except clause
583 setup.py:0:
309 setup.py:0:
584 > # build_py), it will not find osutil & friends, thinking that those modules are
585 warning: line over 80 characters
586 setup.py:0:
587 > except:
310 > except:
588 warning: naked except clause
311 warning: naked except clause
589 warning: naked except clause
312 warning: naked except clause
590 setup.py:0:
313 setup.py:0:
591 > isironpython = platform.python_implementation().lower().find("ironpython") != -1
592 warning: line over 80 characters
593 setup.py:0:
594 > except:
314 > except:
595 warning: naked except clause
315 warning: naked except clause
596 warning: naked except clause
316 warning: naked except clause
@@ -601,24 +321,12 b''
601 tests/run-tests.py:0:
321 tests/run-tests.py:0:
602 > except:
322 > except:
603 warning: naked except clause
323 warning: naked except clause
604 tests/test-commandserver.py:0:
605 > 'hooks.pre-identify=python:test-commandserver.hook', 'id'],
606 warning: line over 80 characters
607 tests/test-commandserver.py:0:
608 > # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it
609 warning: line over 80 characters
610 tests/test-commandserver.py:0:
611 > print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data))
612 warning: line over 80 characters
613 tests/test-convert-mtn.t:0:
324 tests/test-convert-mtn.t:0:
614 > > function get_passphrase(keypair_id)
325 > > function get_passphrase(keypair_id)
615 don't use 'function', use old style
326 don't use 'function', use old style
616 tests/test-filecache.py:0:
327 tests/test-filecache.py:0:
617 > except:
328 > except:
618 warning: naked except clause
329 warning: naked except clause
619 tests/test-filecache.py:0:
620 > if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'cacheable']):
621 warning: line over 80 characters
622 tests/test-import-git.t:0:
330 tests/test-import-git.t:0:
623 > > Mc\${NkU|\`?^000jF3jhEB
331 > > Mc\${NkU|\`?^000jF3jhEB
624 ^ must be quoted
332 ^ must be quoted
@@ -635,9 +343,3 b''
635 tests/test-ui-color.py:0:
343 tests/test-ui-color.py:0:
636 > testui.write('buffered\n')
344 > testui.write('buffered\n')
637 warning: unwrapped ui message
345 warning: unwrapped ui message
638 tests/test-walkrepo.py:0:
639 > print "Found %d repositories when I should have found 2" % (len(reposet),)
640 warning: line over 80 characters
641 tests/test-walkrepo.py:0:
642 > print "Found %d repositories when I should have found 3" % (len(reposet),)
643 warning: line over 80 characters
@@ -71,7 +71,8 b' def unknowncommand(server):'
71 def hellomessage(server):
71 def hellomessage(server):
72 ch, data = readchannel(server)
72 ch, data = readchannel(server)
73 # escaping python tests output not supported
73 # escaping python tests output not supported
74 print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data))
74 print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***',
75 data))
75
76
76 # run an arbitrary command to make sure the next thing the server sends
77 # run an arbitrary command to make sure the next thing the server sends
77 # isn't part of the hello message
78 # isn't part of the hello message
@@ -142,7 +143,8 b' def localhgrc(server):'
142 is used """
143 is used """
143 readchannel(server)
144 readchannel(server)
144
145
145 # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it
146 # the cached repo local hgrc contains ui.foo=bar, so showconfig should
147 # show it
146 runcommand(server, ['showconfig'])
148 runcommand(server, ['showconfig'])
147
149
148 # but not for this repo
150 # but not for this repo
@@ -157,7 +159,8 b' def hook(**args):'
157 def hookoutput(server):
159 def hookoutput(server):
158 readchannel(server)
160 readchannel(server)
159 runcommand(server, ['--config',
161 runcommand(server, ['--config',
160 'hooks.pre-identify=python:test-commandserver.hook', 'id'],
162 'hooks.pre-identify=python:test-commandserver.hook',
163 'id'],
161 input=cStringIO.StringIO('some input'))
164 input=cStringIO.StringIO('some input'))
162
165
163 def outsidechanges(server):
166 def outsidechanges(server):
@@ -1,6 +1,7 b''
1 import sys, os, subprocess
1 import sys, os, subprocess
2
2
3 if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'cacheable']):
3 if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'],
4 'cacheable']):
4 sys.exit(80)
5 sys.exit(80)
5
6
6 from mercurial import util, scmutil, extensions
7 from mercurial import util, scmutil, extensions
@@ -24,10 +24,12 b' def runtest():'
24 reposet = frozenset(walkrepos('.', followsym=True))
24 reposet = frozenset(walkrepos('.', followsym=True))
25 if sym and (len(reposet) != 3):
25 if sym and (len(reposet) != 3):
26 print "reposet = %r" % (reposet,)
26 print "reposet = %r" % (reposet,)
27 print "Found %d repositories when I should have found 3" % (len(reposet),)
27 print ("Found %d repositories when I should have found 3"
28 % (len(reposet),))
28 if (not sym) and (len(reposet) != 2):
29 if (not sym) and (len(reposet) != 2):
29 print "reposet = %r" % (reposet,)
30 print "reposet = %r" % (reposet,)
30 print "Found %d repositories when I should have found 2" % (len(reposet),)
31 print ("Found %d repositories when I should have found 2"
32 % (len(reposet),))
31 sub1set = frozenset((pjoin('.', 'sub1'),
33 sub1set = frozenset((pjoin('.', 'sub1'),
32 pjoin('.', 'circle', 'subdir', 'sub1')))
34 pjoin('.', 'circle', 'subdir', 'sub1')))
33 if len(sub1set & reposet) != 1:
35 if len(sub1set & reposet) != 1:
General Comments 0
You need to be logged in to leave comments. Login now