##// END OF EJS Templates
use new style classes
Benoit Boissinot -
r8778:c5f36402 default
parent child Browse files
Show More
@@ -14,7 +14,7 b' from email.Parser import Parser'
14
14
15 class gnuarch_source(converter_source, commandline):
15 class gnuarch_source(converter_source, commandline):
16
16
17 class gnuarch_rev:
17 class gnuarch_rev(object):
18 def __init__(self, rev):
18 def __init__(self, rev):
19 self.rev = rev
19 self.rev = rev
20 self.summary = ''
20 self.summary = ''
@@ -118,7 +118,7 b' def debugsvnlog(ui, **opts):'
118 args = decodeargs(sys.stdin.read())
118 args = decodeargs(sys.stdin.read())
119 get_log_child(sys.stdout, *args)
119 get_log_child(sys.stdout, *args)
120
120
121 class logstream:
121 class logstream(object):
122 """Interruptible revision log iterator."""
122 """Interruptible revision log iterator."""
123 def __init__(self, stdout):
123 def __init__(self, stdout):
124 self._stdout = stdout
124 self._stdout = stdout
@@ -97,7 +97,7 b' class SvnRaTransport(object):'
97 self.ra = ra
97 self.ra = ra
98 svn.ra.reparent(self.ra, self.svn_url.encode('utf8'))
98 svn.ra.reparent(self.ra, self.svn_url.encode('utf8'))
99
99
100 class Reporter:
100 class Reporter(object):
101 def __init__(self, (reporter, report_baton)):
101 def __init__(self, (reporter, report_baton)):
102 self._reporter = reporter
102 self._reporter = reporter
103 self._baton = report_baton
103 self._baton = report_baton
@@ -10,7 +10,7 b' from mercurial import util, commands, ma'
10 from mercurial import node as hgnode
10 from mercurial import node as hgnode
11 from mercurial.i18n import _
11 from mercurial.i18n import _
12
12
13 class gpg:
13 class gpg(object):
14 def __init__(self, path, key=None):
14 def __init__(self, path, key=None):
15 self.path = path
15 self.path = path
16 self.key = (key and " --local-user \"%s\"" % key) or ""
16 self.key = (key and " --local-user \"%s\"" % key) or ""
@@ -99,7 +99,7 b' class ciamsg(object):'
99 return '\n'.join(msg)
99 return '\n'.join(msg)
100
100
101 def diffstat(self):
101 def diffstat(self):
102 class patchbuf:
102 class patchbuf(object):
103 def __init__(self):
103 def __init__(self):
104 self.lines = []
104 self.lines = []
105 # diffstat is stupid
105 # diffstat is stupid
@@ -23,7 +23,7 b' def serve(ui, repo, **opts):'
23 if timeout:
23 if timeout:
24 timeout = float(timeout) * 1e3
24 timeout = float(timeout) * 1e3
25
25
26 class service:
26 class service(object):
27 def init(self):
27 def init(self):
28 try:
28 try:
29 self.master = server.master(ui, repo, timeout)
29 self.master = server.master(ui, repo, timeout)
@@ -42,7 +42,7 b' commands.norepo += " qclone"'
42 # They must be joinable with queue directory and result in the patch path.
42 # They must be joinable with queue directory and result in the patch path.
43 normname = util.normpath
43 normname = util.normpath
44
44
45 class statusentry:
45 class statusentry(object):
46 def __init__(self, rev, name=None):
46 def __init__(self, rev, name=None):
47 if not name:
47 if not name:
48 fields = rev.split(':', 1)
48 fields = rev.split(':', 1)
@@ -191,7 +191,7 b' class patchheader(object):'
191 ci += 1
191 ci += 1
192 del self.comments[ci]
192 del self.comments[ci]
193
193
194 class queue:
194 class queue(object):
195 def __init__(self, ui, path, patchdir=None):
195 def __init__(self, ui, path, patchdir=None):
196 self.basepath = path
196 self.basepath = path
197 self.path = patchdir or os.path.join(path, "patches")
197 self.path = patchdir or os.path.join(path, "patches")
@@ -18,12 +18,12 b' import os, tempfile'
18 from mercurial import bundlerepo, changegroup, cmdutil, hg, merge, match
18 from mercurial import bundlerepo, changegroup, cmdutil, hg, merge, match
19 from mercurial import patch, revlog, util, error
19 from mercurial import patch, revlog, util, error
20
20
21 class transplantentry:
21 class transplantentry(object):
22 def __init__(self, lnode, rnode):
22 def __init__(self, lnode, rnode):
23 self.lnode = lnode
23 self.lnode = lnode
24 self.rnode = rnode
24 self.rnode = rnode
25
25
26 class transplants:
26 class transplants(object):
27 def __init__(self, path=None, transplantfile=None, opener=None):
27 def __init__(self, path=None, transplantfile=None, opener=None):
28 self.path = path
28 self.path = path
29 self.transplantfile = transplantfile
29 self.transplantfile = transplantfile
@@ -64,7 +64,7 b' class transplants:'
64 del self.transplants[self.transplants.index(transplant)]
64 del self.transplants[self.transplants.index(transplant)]
65 self.dirty = True
65 self.dirty = True
66
66
67 class transplanter:
67 class transplanter(object):
68 def __init__(self, ui, repo):
68 def __init__(self, ui, repo):
69 self.ui = ui
69 self.ui = ui
70 self.path = repo.join('transplant')
70 self.path = repo.join('transplant')
@@ -34,7 +34,7 b' def tidyprefix(dest, prefix, suffixes):'
34 raise util.Abort(_('archive prefix contains illegal components'))
34 raise util.Abort(_('archive prefix contains illegal components'))
35 return prefix
35 return prefix
36
36
37 class tarit:
37 class tarit(object):
38 '''write archive to tar file or stream. can write uncompressed,
38 '''write archive to tar file or stream. can write uncompressed,
39 or compress with gzip or bzip2.'''
39 or compress with gzip or bzip2.'''
40
40
@@ -106,7 +106,7 b' class tarit:'
106 def done(self):
106 def done(self):
107 self.z.close()
107 self.z.close()
108
108
109 class tellable:
109 class tellable(object):
110 '''provide tell method for zipfile.ZipFile when writing to http
110 '''provide tell method for zipfile.ZipFile when writing to http
111 response file object.'''
111 response file object.'''
112
112
@@ -124,7 +124,7 b' class tellable:'
124 def tell(self):
124 def tell(self):
125 return self.offset
125 return self.offset
126
126
127 class zipit:
127 class zipit(object):
128 '''write archive to zip file or stream. can write uncompressed,
128 '''write archive to zip file or stream. can write uncompressed,
129 or compressed with deflate.'''
129 or compressed with deflate.'''
130
130
@@ -156,7 +156,7 b' class zipit:'
156 def done(self):
156 def done(self):
157 self.z.close()
157 self.z.close()
158
158
159 class fileit:
159 class fileit(object):
160 '''write archive as files in directory.'''
160 '''write archive as files in directory.'''
161
161
162 def __init__(self, name, prefix, mtime):
162 def __init__(self, name, prefix, mtime):
@@ -36,7 +36,7 b' def encodeextra(d):'
36 items = [_string_escape('%s:%s' % (k, d[k])) for k in sorted(d)]
36 items = [_string_escape('%s:%s' % (k, d[k])) for k in sorted(d)]
37 return "\0".join(items)
37 return "\0".join(items)
38
38
39 class appender:
39 class appender(object):
40 '''the changelog index must be updated last on disk, so we use this class
40 '''the changelog index must be updated last on disk, so we use this class
41 to delay writes to it'''
41 to delay writes to it'''
42 def __init__(self, fp, buf):
42 def __init__(self, fp, buf):
@@ -1110,7 +1110,7 b' def walkchangerevs(ui, repo, pats, chang'
1110 fncache[rev] = matches
1110 fncache[rev] = matches
1111 wanted.add(rev)
1111 wanted.add(rev)
1112
1112
1113 class followfilter:
1113 class followfilter(object):
1114 def __init__(self, onlyfirst=False):
1114 def __init__(self, onlyfirst=False):
1115 self.startrev = nullrev
1115 self.startrev = nullrev
1116 self.roots = []
1116 self.roots = []
@@ -2697,7 +2697,7 b' def serve(ui, repo, **opts):'
2697 raise error.RepoError(_("There is no Mercurial repository here"
2697 raise error.RepoError(_("There is no Mercurial repository here"
2698 " (.hg not found)"))
2698 " (.hg not found)"))
2699
2699
2700 class service:
2700 class service(object):
2701 def init(self):
2701 def init(self):
2702 util.set_signal_handler()
2702 util.set_signal_handler()
2703 self.httpd = server.create_server(baseui, repo)
2703 self.httpd = server.create_server(baseui, repo)
@@ -147,7 +147,7 b' GP_PATCH = 1 << 0 # we have to run pat'
147 GP_FILTER = 1 << 1 # there's some copy/rename operation
147 GP_FILTER = 1 << 1 # there's some copy/rename operation
148 GP_BINARY = 1 << 2 # there's a binary patch
148 GP_BINARY = 1 << 2 # there's a binary patch
149
149
150 class patchmeta:
150 class patchmeta(object):
151 """Patched file metadata
151 """Patched file metadata
152
152
153 'op' is the performed operation within ADD, DELETE, RENAME, MODIFY
153 'op' is the performed operation within ADD, DELETE, RENAME, MODIFY
@@ -232,7 +232,7 b' def readgitpatch(lr):'
232 unidesc = re.compile('@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@')
232 unidesc = re.compile('@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@')
233 contextdesc = re.compile('(---|\*\*\*) (\d+)(,(\d+))? (---|\*\*\*)')
233 contextdesc = re.compile('(---|\*\*\*) (\d+)(,(\d+))? (---|\*\*\*)')
234
234
235 class patchfile:
235 class patchfile(object):
236 def __init__(self, ui, fname, opener, missing=False):
236 def __init__(self, ui, fname, opener, missing=False):
237 self.fname = fname
237 self.fname = fname
238 self.opener = opener
238 self.opener = opener
@@ -432,7 +432,7 b' class patchfile:'
432 self.rej.append(h)
432 self.rej.append(h)
433 return -1
433 return -1
434
434
435 class hunk:
435 class hunk(object):
436 def __init__(self, desc, num, lr, context, create=False, remove=False):
436 def __init__(self, desc, num, lr, context, create=False, remove=False):
437 self.number = num
437 self.number = num
438 self.desc = desc
438 self.desc = desc
@@ -782,7 +782,7 b' def selectfile(afile_orig, bfile_orig, h'
782
782
783 return fname, missing
783 return fname, missing
784
784
785 class linereader:
785 class linereader(object):
786 # simple class to allow pushing lines back into the input stream
786 # simple class to allow pushing lines back into the input stream
787 def __init__(self, fp):
787 def __init__(self, fp):
788 self.fp = fp
788 self.fp = fp
@@ -165,7 +165,7 b' def _calcmode(path):'
165
165
166 _data = 'data 00manifest.d 00manifest.i 00changelog.d 00changelog.i'
166 _data = 'data 00manifest.d 00manifest.i 00changelog.d 00changelog.i'
167
167
168 class basicstore:
168 class basicstore(object):
169 '''base class for local repository stores'''
169 '''base class for local repository stores'''
170 def __init__(self, path, opener, pathjoiner):
170 def __init__(self, path, opener, pathjoiner):
171 self.pathjoiner = pathjoiner
171 self.pathjoiner = pathjoiner
@@ -749,7 +749,7 b' def mktempcopy(name, emptyok=False, crea'
749 raise
749 raise
750 return temp
750 return temp
751
751
752 class atomictempfile:
752 class atomictempfile(object):
753 """file-like object that atomically updates a file
753 """file-like object that atomically updates a file
754
754
755 All writes will be redirected to a temporary copy of the original
755 All writes will be redirected to a temporary copy of the original
@@ -20,7 +20,7 b" def posixfile(name, mode='r', buffering="
20 raise WinIOError(err)
20 raise WinIOError(err)
21 posixfile.__doc__ = osutil.posixfile.__doc__
21 posixfile.__doc__ = osutil.posixfile.__doc__
22
22
23 class winstdout:
23 class winstdout(object):
24 '''stdout on windows misbehaves if sent through a pipe'''
24 '''stdout on windows misbehaves if sent through a pipe'''
25
25
26 def __init__(self, fp):
26 def __init__(self, fp):
General Comments 0
You need to be logged in to leave comments. Login now