##// END OF EJS Templates
Convert all classes to new-style classes by deriving them from object.
Eric Hopper -
r1559:59b3639d default
parent child Browse files
Show More
@@ -26,7 +26,7 b' def check_clean(ui, repo):'
26 ui.warn("Repository is not clean, please commit or revert\n")
26 ui.warn("Repository is not clean, please commit or revert\n")
27 sys.exit(1)
27 sys.exit(1)
28
28
29 class bisect:
29 class bisect(object):
30 """dichotomic search in the DAG of changesets"""
30 """dichotomic search in the DAG of changesets"""
31 def __init__(self, ui, repo):
31 def __init__(self, ui, repo):
32 self.repo = repo
32 self.repo = repo
@@ -678,7 +678,7 b' def clone(ui, source, dest=None, **opts)'
678
678
679 dest = os.path.realpath(dest)
679 dest = os.path.realpath(dest)
680
680
681 class Dircleanup:
681 class Dircleanup(object):
682 def __init__(self, dir_):
682 def __init__(self, dir_):
683 self.rmtree = shutil.rmtree
683 self.rmtree = shutil.rmtree
684 self.dir_ = dir_
684 self.dir_ = dir_
@@ -1188,7 +1188,7 b' def grep(ui, repo, pattern, *pats, **opt'
1188 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
1188 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
1189 begin = lend + 1
1189 begin = lend + 1
1190
1190
1191 class linestate:
1191 class linestate(object):
1192 def __init__(self, line, linenum, colstart, colend):
1192 def __init__(self, line, linenum, colstart, colend):
1193 self.line = line
1193 self.line = line
1194 self.linenum = linenum
1194 self.linenum = linenum
@@ -1479,7 +1479,7 b' def log(ui, repo, *pats, **opts):'
1479 -v switch adds some more detail, such as changed files, manifest
1479 -v switch adds some more detail, such as changed files, manifest
1480 hashes or message signatures.
1480 hashes or message signatures.
1481 """
1481 """
1482 class dui:
1482 class dui(object):
1483 # Implement and delegate some ui protocol. Save hunks of
1483 # Implement and delegate some ui protocol. Save hunks of
1484 # output for later display in the desired order.
1484 # output for later display in the desired order.
1485 def __init__(self, ui):
1485 def __init__(self, ui):
@@ -13,7 +13,7 b' from i18n import gettext as _'
13 from demandload import *
13 from demandload import *
14 demandload(globals(), "time bisect stat util re errno")
14 demandload(globals(), "time bisect stat util re errno")
15
15
16 class dirstate:
16 class dirstate(object):
17 def __init__(self, opener, ui, root):
17 def __init__(self, opener, ui, root):
18 self.opener = opener
18 self.opener = opener
19 self.root = root
19 self.root = root
@@ -71,7 +71,7 b' def get_mtime(repo_path):'
71 else:
71 else:
72 return os.stat(hg_path).st_mtime
72 return os.stat(hg_path).st_mtime
73
73
74 class hgrequest:
74 class hgrequest(object):
75 def __init__(self, inp=None, out=None, env=None):
75 def __init__(self, inp=None, out=None, env=None):
76 self.inp = inp or sys.stdin
76 self.inp = inp or sys.stdin
77 self.out = out or sys.stdout
77 self.out = out or sys.stdout
@@ -104,7 +104,7 b' class hgrequest:'
104 headers.append(('Content-length', str(size)))
104 headers.append(('Content-length', str(size)))
105 self.header(headers)
105 self.header(headers)
106
106
107 class templater:
107 class templater(object):
108 def __init__(self, mapfile, filters={}, defaults={}):
108 def __init__(self, mapfile, filters={}, defaults={}):
109 self.cache = {}
109 self.cache = {}
110 self.map = {}
110 self.map = {}
@@ -175,7 +175,7 b' common_filters = {'
175 "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"),
175 "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"),
176 }
176 }
177
177
178 class hgweb:
178 class hgweb(object):
179 def __init__(self, repo, name=None):
179 def __init__(self, repo, name=None):
180 if type(repo) == type(""):
180 if type(repo) == type(""):
181 self.repo = hg.repository(ui.ui(), repo)
181 self.repo = hg.repository(ui.ui(), repo)
@@ -952,7 +952,7 b' def create_server(repo):'
952 return BaseHTTPServer.HTTPServer((address, port), hgwebhandler)
952 return BaseHTTPServer.HTTPServer((address, port), hgwebhandler)
953
953
954 # This is a stopgap
954 # This is a stopgap
955 class hgwebdir:
955 class hgwebdir(object):
956 def __init__(self, config):
956 def __init__(self, config):
957 def cleannames(items):
957 def cleannames(items):
958 return [(name.strip('/'), path) for name, path in items]
958 return [(name.strip('/'), path) for name, path in items]
@@ -7,7 +7,7 b''
7
7
8 import byterange, urllib2
8 import byterange, urllib2
9
9
10 class httprangereader:
10 class httprangereader(object):
11 def __init__(self, url):
11 def __init__(self, url):
12 self.url = url
12 self.url = url
13 self.pos = 0
13 self.pos = 0
@@ -12,7 +12,7 b' from i18n import gettext as _'
12 from demandload import *
12 from demandload import *
13 demandload(globals(), "re lock transaction tempfile stat mdiff errno")
13 demandload(globals(), "re lock transaction tempfile stat mdiff errno")
14
14
15 class localrepository:
15 class localrepository(object):
16 def __init__(self, ui, path=None, create=0):
16 def __init__(self, ui, path=None, create=0):
17 if not path:
17 if not path:
18 p = os.getcwd()
18 p = os.getcwd()
@@ -11,7 +11,7 b' import util'
11 class LockHeld(Exception):
11 class LockHeld(Exception):
12 pass
12 pass
13
13
14 class lock:
14 class lock(object):
15 def __init__(self, file, wait=1, releasefn=None):
15 def __init__(self, file, wait=1, releasefn=None):
16 self.f = file
16 self.f = file
17 self.held = 0
17 self.held = 0
@@ -5,11 +5,11 b''
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7
7
8 class remoterepository:
8 class remoterepository(object):
9 def local(self):
9 def local(self):
10 return False
10 return False
11
11
12 class remotelock:
12 class remotelock(object):
13 def __init__(self, repo):
13 def __init__(self, repo):
14 self.repo = repo
14 self.repo = repo
15 def release(self):
15 def release(self):
@@ -52,7 +52,7 b' def decompress(bin):'
52
52
53 indexformat = ">4l20s20s20s"
53 indexformat = ">4l20s20s20s"
54
54
55 class lazyparser:
55 class lazyparser(object):
56 """
56 """
57 this class avoids the need to parse the entirety of large indices
57 this class avoids the need to parse the entirety of large indices
58
58
@@ -94,7 +94,7 b' class lazyparser:'
94 self.map[e[6]] = i
94 self.map[e[6]] = i
95 i += 1
95 i += 1
96
96
97 class lazyindex:
97 class lazyindex(object):
98 """a lazy version of the index array"""
98 """a lazy version of the index array"""
99 def __init__(self, parser):
99 def __init__(self, parser):
100 self.p = parser
100 self.p = parser
@@ -114,7 +114,7 b' class lazyindex:'
114 def trunc(self, pos):
114 def trunc(self, pos):
115 self.p.trunc(pos)
115 self.p.trunc(pos)
116
116
117 class lazymap:
117 class lazymap(object):
118 """a lazy version of the node map"""
118 """a lazy version of the node map"""
119 def __init__(self, parser):
119 def __init__(self, parser):
120 self.p = parser
120 self.p = parser
@@ -152,7 +152,7 b' class lazymap:'
152
152
153 class RevlogError(Exception): pass
153 class RevlogError(Exception): pass
154
154
155 class revlog:
155 class revlog(object):
156 """
156 """
157 the underlying revision storage object
157 the underlying revision storage object
158
158
@@ -14,7 +14,7 b''
14 import os
14 import os
15 from i18n import gettext as _
15 from i18n import gettext as _
16
16
17 class transaction:
17 class transaction(object):
18 def __init__(self, report, opener, journal, after=None):
18 def __init__(self, report, opener, journal, after=None):
19 self.journal = None
19 self.journal = None
20
20
@@ -10,7 +10,7 b' from i18n import gettext as _'
10 from demandload import *
10 from demandload import *
11 demandload(globals(), "re socket sys util")
11 demandload(globals(), "re socket sys util")
12
12
13 class ui:
13 class ui(object):
14 def __init__(self, verbose=False, debug=False, quiet=False,
14 def __init__(self, verbose=False, debug=False, quiet=False,
15 interactive=True):
15 interactive=True):
16 self.overlay = {}
16 self.overlay = {}
General Comments 0
You need to be logged in to leave comments. Login now