Show More
@@ -58,7 +58,7 b' def __gather(ui, repo, node1, node2):' | |||||
58 |
|
58 | |||
59 | for f in added: |
|
59 | for f in added: | |
60 | lines += dirtywork(f, None, mmap2) |
|
60 | lines += dirtywork(f, None, mmap2) | |
61 |
|
61 | |||
62 | for f in removed: |
|
62 | for f in removed: | |
63 | lines += dirtywork(f, mmap1, None) |
|
63 | lines += dirtywork(f, mmap1, None) | |
64 |
|
64 | |||
@@ -72,7 +72,7 b' def __gather(ui, repo, node1, node2):' | |||||
72 |
|
72 | |||
73 | def gather_stats(ui, repo, amap, revs=None, progress=False): |
|
73 | def gather_stats(ui, repo, amap, revs=None, progress=False): | |
74 | stats = {} |
|
74 | stats = {} | |
75 |
|
75 | |||
76 | cl = repo.changelog |
|
76 | cl = repo.changelog | |
77 |
|
77 | |||
78 | if not revs: |
|
78 | if not revs: | |
@@ -117,7 +117,7 b' def gather_stats(ui, repo, amap, revs=No' | |||||
117 |
|
117 | |||
118 | def churn(ui, repo, **opts): |
|
118 | def churn(ui, repo, **opts): | |
119 | "Graphs the number of lines changed" |
|
119 | "Graphs the number of lines changed" | |
120 |
|
120 | |||
121 | def pad(s, l): |
|
121 | def pad(s, l): | |
122 | if len(s) < l: |
|
122 | if len(s) < l: | |
123 | return s + " " * (l-len(s)) |
|
123 | return s + " " * (l-len(s)) | |
@@ -125,7 +125,7 b' def churn(ui, repo, **opts):' | |||||
125 |
|
125 | |||
126 | def graph(n, maximum, width, char): |
|
126 | def graph(n, maximum, width, char): | |
127 | n = int(n * width / float(maximum)) |
|
127 | n = int(n * width / float(maximum)) | |
128 |
|
128 | |||
129 | return char * (n) |
|
129 | return char * (n) | |
130 |
|
130 | |||
131 | def get_aliases(f): |
|
131 | def get_aliases(f): | |
@@ -137,7 +137,7 b' def churn(ui, repo, **opts):' | |||||
137 | aliases[alias] = actual |
|
137 | aliases[alias] = actual | |
138 |
|
138 | |||
139 | return aliases |
|
139 | return aliases | |
140 |
|
140 | |||
141 | amap = {} |
|
141 | amap = {} | |
142 | aliases = opts.get('aliases') |
|
142 | aliases = opts.get('aliases') | |
143 | if aliases: |
|
143 | if aliases: |
@@ -63,7 +63,7 b" def fetch(ui, repo, source='default', **" | |||||
63 | revs = [other.lookup(rev) for rev in opts['rev']] |
|
63 | revs = [other.lookup(rev) for rev in opts['rev']] | |
64 | modheads = repo.pull(other, heads=revs, lock=lock) |
|
64 | modheads = repo.pull(other, heads=revs, lock=lock) | |
65 | return postincoming(other, modheads) |
|
65 | return postincoming(other, modheads) | |
66 |
|
66 | |||
67 | parent, p2 = repo.dirstate.parents() |
|
67 | parent, p2 = repo.dirstate.parents() | |
68 | if parent != repo.changelog.tip(): |
|
68 | if parent != repo.changelog.tip(): | |
69 | raise util.Abort(_('working dir not at tip ' |
|
69 | raise util.Abort(_('working dir not at tip ' |
@@ -130,7 +130,7 b' class queue:' | |||||
130 | for c in bad_chars: |
|
130 | for c in bad_chars: | |
131 | if c in guard: |
|
131 | if c in guard: | |
132 | return _('invalid character in guard %r: %r') % (guard, c) |
|
132 | return _('invalid character in guard %r: %r') % (guard, c) | |
133 |
|
133 | |||
134 | def set_active(self, guards): |
|
134 | def set_active(self, guards): | |
135 | for guard in guards: |
|
135 | for guard in guards: | |
136 | bad = self.check_guard(guard) |
|
136 | bad = self.check_guard(guard) | |
@@ -172,7 +172,7 b' class queue:' | |||||
172 | self.full_series[idx] = drop + ''.join([' #' + g for g in guards]) |
|
172 | self.full_series[idx] = drop + ''.join([' #' + g for g in guards]) | |
173 | self.parse_series() |
|
173 | self.parse_series() | |
174 | self.series_dirty = True |
|
174 | self.series_dirty = True | |
175 |
|
175 | |||
176 | def pushable(self, idx): |
|
176 | def pushable(self, idx): | |
177 | if isinstance(idx, str): |
|
177 | if isinstance(idx, str): | |
178 | idx = self.series.index(idx) |
|
178 | idx = self.series.index(idx) | |
@@ -724,7 +724,7 b' class queue:' | |||||
724 | return (i, a.rev, a.name) |
|
724 | return (i, a.rev, a.name) | |
725 | return None |
|
725 | return None | |
726 |
|
726 | |||
727 |
# if the exact patch name does not exist, we try a few |
|
727 | # if the exact patch name does not exist, we try a few | |
728 | # variations. If strict is passed, we try only #1 |
|
728 | # variations. If strict is passed, we try only #1 | |
729 | # |
|
729 | # | |
730 | # 1) a number to indicate an offset in the series file |
|
730 | # 1) a number to indicate an offset in the series file | |
@@ -1638,7 +1638,7 b' def guard(ui, repo, *args, **opts):' | |||||
1638 | hg qguard -- -foo |
|
1638 | hg qguard -- -foo | |
1639 |
|
1639 | |||
1640 | To set guards on another patch: |
|
1640 | To set guards on another patch: | |
1641 |
hg qguard other.patch +2.6.17 -stable |
|
1641 | hg qguard other.patch +2.6.17 -stable | |
1642 | ''' |
|
1642 | ''' | |
1643 | def status(idx): |
|
1643 | def status(idx): | |
1644 | guards = q.series_guards[idx] or ['unguarded'] |
|
1644 | guards = q.series_guards[idx] or ['unguarded'] | |
@@ -1765,7 +1765,7 b' def rename(ui, repo, patch, name=None, *' | |||||
1765 | absdest = q.join(name) |
|
1765 | absdest = q.join(name) | |
1766 | if os.path.exists(absdest): |
|
1766 | if os.path.exists(absdest): | |
1767 | raise util.Abort(_('%s already exists') % absdest) |
|
1767 | raise util.Abort(_('%s already exists') % absdest) | |
1768 |
|
1768 | |||
1769 | if name in q.series: |
|
1769 | if name in q.series: | |
1770 | raise util.Abort(_('A patch named %s already exists in the series file') % name) |
|
1770 | raise util.Abort(_('A patch named %s already exists in the series file') % name) | |
1771 |
|
1771 | |||
@@ -1862,7 +1862,7 b' def select(ui, repo, *args, **opts):' | |||||
1862 |
|
1862 | |||
1863 | With no arguments, prints the currently active guards. |
|
1863 | With no arguments, prints the currently active guards. | |
1864 | With one argument, sets the active guard. |
|
1864 | With one argument, sets the active guard. | |
1865 |
|
1865 | |||
1866 | Use -n/--none to deactivate guards (no other arguments needed). |
|
1866 | Use -n/--none to deactivate guards (no other arguments needed). | |
1867 | When no guards are active, patches with positive guards are skipped |
|
1867 | When no guards are active, patches with positive guards are skipped | |
1868 | and patches with negative guards are pushed. |
|
1868 | and patches with negative guards are pushed. | |
@@ -1952,7 +1952,7 b' def reposetup(ui, repo):' | |||||
1952 | parent = revlog.hex(self.dirstate.parents()[0]) |
|
1952 | parent = revlog.hex(self.dirstate.parents()[0]) | |
1953 | if parent in [s.rev for s in self.mq.applied]: |
|
1953 | if parent in [s.rev for s in self.mq.applied]: | |
1954 | raise util.Abort(errmsg) |
|
1954 | raise util.Abort(errmsg) | |
1955 |
|
1955 | |||
1956 | def commit(self, *args, **opts): |
|
1956 | def commit(self, *args, **opts): | |
1957 | if len(args) >= 6: |
|
1957 | if len(args) >= 6: | |
1958 | force = args[5] |
|
1958 | force = args[5] | |
@@ -1968,7 +1968,7 b' def reposetup(ui, repo):' | |||||
1968 | if self.mq.applied and not force: |
|
1968 | if self.mq.applied and not force: | |
1969 | raise util.Abort(_('source has mq patches applied')) |
|
1969 | raise util.Abort(_('source has mq patches applied')) | |
1970 | return super(mqrepo, self).push(remote, force, revs) |
|
1970 | return super(mqrepo, self).push(remote, force, revs) | |
1971 |
|
1971 | |||
1972 | def tags(self): |
|
1972 | def tags(self): | |
1973 | if self.tagscache: |
|
1973 | if self.tagscache: | |
1974 | return self.tagscache |
|
1974 | return self.tagscache |
@@ -2502,7 +2502,7 b' def status(ui, repo, *pats, **opts):' | |||||
2502 | """ |
|
2502 | """ | |
2503 |
|
2503 | |||
2504 | all = opts['all'] |
|
2504 | all = opts['all'] | |
2505 |
|
2505 | |||
2506 | files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
|
2506 | files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) | |
2507 | cwd = (pats and repo.getcwd()) or '' |
|
2507 | cwd = (pats and repo.getcwd()) or '' | |
2508 | modified, added, removed, deleted, unknown, ignored, clean = [ |
|
2508 | modified, added, removed, deleted, unknown, ignored, clean = [ | |
@@ -3236,7 +3236,7 b' def load_extensions(ui):' | |||||
3236 | if t in table: |
|
3236 | if t in table: | |
3237 | ui.warn(_("module %s overrides %s\n") % (name, t)) |
|
3237 | ui.warn(_("module %s overrides %s\n") % (name, t)) | |
3238 | table.update(cmdtable) |
|
3238 | table.update(cmdtable) | |
3239 |
|
3239 | |||
3240 | def dispatch(args): |
|
3240 | def dispatch(args): | |
3241 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
|
3241 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': | |
3242 | num = getattr(signal, name, None) |
|
3242 | num = getattr(signal, name, None) |
@@ -223,7 +223,7 b' class filectx(object):' | |||||
223 | pl[0] = (r[0], getlog(r[0]).rev(r[1])) |
|
223 | pl[0] = (r[0], getlog(r[0]).rev(r[1])) | |
224 |
|
224 | |||
225 | return [ getctx(p, n) for p, n in pl if n != -1 ] |
|
225 | return [ getctx(p, n) for p, n in pl if n != -1 ] | |
226 |
|
226 | |||
227 | # find all ancestors |
|
227 | # find all ancestors | |
228 | needed = {self: 1} |
|
228 | needed = {self: 1} | |
229 | visit = [self] |
|
229 | visit = [self] |
@@ -206,7 +206,7 b' class dirstate(object):' | |||||
206 | self.dirs = {} |
|
206 | self.dirs = {} | |
207 | for f in self.map: |
|
207 | for f in self.map: | |
208 | self.updatedirs(f, 1) |
|
208 | self.updatedirs(f, 1) | |
209 |
|
209 | |||
210 | def updatedirs(self, path, delta): |
|
210 | def updatedirs(self, path, delta): | |
211 | if self.dirs is not None: |
|
211 | if self.dirs is not None: | |
212 | for c in strutil.findall(path, '/'): |
|
212 | for c in strutil.findall(path, '/'): |
@@ -37,7 +37,7 b' class hgwebdir(object):' | |||||
37 | if cp.has_option('web', 'motd'): |
|
37 | if cp.has_option('web', 'motd'): | |
38 | self.motd = cp.get('web', 'motd') |
|
38 | self.motd = cp.get('web', 'motd') | |
39 | if cp.has_option('web', 'style'): |
|
39 | if cp.has_option('web', 'style'): | |
40 |
|
|
40 | self.style = cp.get('web', 'style') | |
41 | if cp.has_section('paths'): |
|
41 | if cp.has_section('paths'): | |
42 | self.repos.extend(cleannames(cp.items('paths'))) |
|
42 | self.repos.extend(cleannames(cp.items('paths'))) | |
43 | if cp.has_section('collections'): |
|
43 | if cp.has_section('collections'): |
@@ -165,7 +165,7 b' class httprepository(remoterepository):' | |||||
165 | proxyuser, proxypasswd or ''), |
|
165 | proxyuser, proxypasswd or ''), | |
166 | proxypath, proxyquery, proxyfrag)) |
|
166 | proxypath, proxyquery, proxyfrag)) | |
167 | handler = urllib2.ProxyHandler({scheme: proxyurl}) |
|
167 | handler = urllib2.ProxyHandler({scheme: proxyurl}) | |
168 |
ui.debug(_('proxying through http://%s:%s\n') % |
|
168 | ui.debug(_('proxying through http://%s:%s\n') % | |
169 | (proxyhost, proxyport)) |
|
169 | (proxyhost, proxyport)) | |
170 |
|
170 | |||
171 | # urllib2 takes proxy values from the environment and those |
|
171 | # urllib2 takes proxy values from the environment and those |
@@ -1760,6 +1760,6 b' def aftertrans(base):' | |||||
1760 |
|
1760 | |||
1761 | def instance(ui, path, create): |
|
1761 | def instance(ui, path, create): | |
1762 | return localrepository(ui, util.drop_scheme('file', path), create) |
|
1762 | return localrepository(ui, util.drop_scheme('file', path), create) | |
1763 |
|
1763 | |||
1764 | def islocal(path): |
|
1764 | def islocal(path): | |
1765 | return True |
|
1765 | return True |
@@ -53,7 +53,7 b' class manifest(revlog):' | |||||
53 | for f, n in self.parselines(delta): |
|
53 | for f, n in self.parselines(delta): | |
54 | deltamap.rawset(f, n) |
|
54 | deltamap.rawset(f, n) | |
55 | return deltamap |
|
55 | return deltamap | |
56 |
|
56 | |||
57 | def read(self, node): |
|
57 | def read(self, node): | |
58 | if node == nullid: return manifestdict() # don't upset local cache |
|
58 | if node == nullid: return manifestdict() # don't upset local cache | |
59 | if self.mapcache and self.mapcache[0] == node: |
|
59 | if self.mapcache and self.mapcache[0] == node: |
@@ -128,7 +128,7 b' def readgitpatch(patchname):' | |||||
128 | self.op = 'MODIFY' |
|
128 | self.op = 'MODIFY' | |
129 | self.copymod = False |
|
129 | self.copymod = False | |
130 | self.lineno = 0 |
|
130 | self.lineno = 0 | |
131 |
|
131 | |||
132 | # Filter patch for git information |
|
132 | # Filter patch for git information | |
133 | gitre = re.compile('diff --git a/(.*) b/(.*)') |
|
133 | gitre = re.compile('diff --git a/(.*) b/(.*)') | |
134 | pf = file(patchname) |
|
134 | pf = file(patchname) |
@@ -124,7 +124,7 b' class sshserver(object):' | |||||
124 | def client_url(self): |
|
124 | def client_url(self): | |
125 | client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0] |
|
125 | client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0] | |
126 | return 'remote:ssh:' + client |
|
126 | return 'remote:ssh:' + client | |
127 |
|
127 | |||
128 | def do_unbundle(self): |
|
128 | def do_unbundle(self): | |
129 | their_heads = self.getarg()[1].split() |
|
129 | their_heads = self.getarg()[1].split() | |
130 |
|
130 |
@@ -87,19 +87,19 b' class StatementFindingAstVisitor(compile' | |||||
87 | self.excluded = excluded |
|
87 | self.excluded = excluded | |
88 | self.suite_spots = suite_spots |
|
88 | self.suite_spots = suite_spots | |
89 | self.excluding_suite = 0 |
|
89 | self.excluding_suite = 0 | |
90 |
|
90 | |||
91 | def doRecursive(self, node): |
|
91 | def doRecursive(self, node): | |
92 | self.recordNodeLine(node) |
|
92 | self.recordNodeLine(node) | |
93 | for n in node.getChildNodes(): |
|
93 | for n in node.getChildNodes(): | |
94 | self.dispatch(n) |
|
94 | self.dispatch(n) | |
95 |
|
95 | |||
96 | visitStmt = visitModule = doRecursive |
|
96 | visitStmt = visitModule = doRecursive | |
97 |
|
97 | |||
98 | def doCode(self, node): |
|
98 | def doCode(self, node): | |
99 | if hasattr(node, 'decorators') and node.decorators: |
|
99 | if hasattr(node, 'decorators') and node.decorators: | |
100 | self.dispatch(node.decorators) |
|
100 | self.dispatch(node.decorators) | |
101 | self.doSuite(node, node.code) |
|
101 | self.doSuite(node, node.code) | |
102 |
|
102 | |||
103 | visitFunction = visitClass = doCode |
|
103 | visitFunction = visitClass = doCode | |
104 |
|
104 | |||
105 | def getFirstLine(self, node): |
|
105 | def getFirstLine(self, node): | |
@@ -119,17 +119,17 b' class StatementFindingAstVisitor(compile' | |||||
119 | for n in node.getChildNodes(): |
|
119 | for n in node.getChildNodes(): | |
120 | lineno = max(lineno, self.getLastLine(n)) |
|
120 | lineno = max(lineno, self.getLastLine(n)) | |
121 | return lineno |
|
121 | return lineno | |
122 |
|
122 | |||
123 | def doStatement(self, node): |
|
123 | def doStatement(self, node): | |
124 | self.recordLine(self.getFirstLine(node)) |
|
124 | self.recordLine(self.getFirstLine(node)) | |
125 |
|
125 | |||
126 | visitAssert = visitAssign = visitAssTuple = visitDiscard = visitPrint = \ |
|
126 | visitAssert = visitAssign = visitAssTuple = visitDiscard = visitPrint = \ | |
127 | visitPrintnl = visitRaise = visitSubscript = visitDecorators = \ |
|
127 | visitPrintnl = visitRaise = visitSubscript = visitDecorators = \ | |
128 | doStatement |
|
128 | doStatement | |
129 |
|
129 | |||
130 | def recordNodeLine(self, node): |
|
130 | def recordNodeLine(self, node): | |
131 | return self.recordLine(node.lineno) |
|
131 | return self.recordLine(node.lineno) | |
132 |
|
132 | |||
133 | def recordLine(self, lineno): |
|
133 | def recordLine(self, lineno): | |
134 | # Returns a bool, whether the line is included or excluded. |
|
134 | # Returns a bool, whether the line is included or excluded. | |
135 | if lineno: |
|
135 | if lineno: | |
@@ -153,9 +153,9 b' class StatementFindingAstVisitor(compile' | |||||
153 | self.statements[lineno] = 1 |
|
153 | self.statements[lineno] = 1 | |
154 | return 1 |
|
154 | return 1 | |
155 | return 0 |
|
155 | return 0 | |
156 |
|
156 | |||
157 | default = recordNodeLine |
|
157 | default = recordNodeLine | |
158 |
|
158 | |||
159 | def recordAndDispatch(self, node): |
|
159 | def recordAndDispatch(self, node): | |
160 | self.recordNodeLine(node) |
|
160 | self.recordNodeLine(node) | |
161 | self.dispatch(node) |
|
161 | self.dispatch(node) | |
@@ -166,7 +166,7 b' class StatementFindingAstVisitor(compile' | |||||
166 | self.excluding_suite = 1 |
|
166 | self.excluding_suite = 1 | |
167 | self.recordAndDispatch(body) |
|
167 | self.recordAndDispatch(body) | |
168 | self.excluding_suite = exsuite |
|
168 | self.excluding_suite = exsuite | |
169 |
|
169 | |||
170 | def doPlainWordSuite(self, prevsuite, suite): |
|
170 | def doPlainWordSuite(self, prevsuite, suite): | |
171 | # Finding the exclude lines for else's is tricky, because they aren't |
|
171 | # Finding the exclude lines for else's is tricky, because they aren't | |
172 | # present in the compiler parse tree. Look at the previous suite, |
|
172 | # present in the compiler parse tree. Look at the previous suite, | |
@@ -180,11 +180,11 b' class StatementFindingAstVisitor(compile' | |||||
180 | break |
|
180 | break | |
181 | else: |
|
181 | else: | |
182 | self.doSuite(None, suite) |
|
182 | self.doSuite(None, suite) | |
183 |
|
183 | |||
184 | def doElse(self, prevsuite, node): |
|
184 | def doElse(self, prevsuite, node): | |
185 | if node.else_: |
|
185 | if node.else_: | |
186 | self.doPlainWordSuite(prevsuite, node.else_) |
|
186 | self.doPlainWordSuite(prevsuite, node.else_) | |
187 |
|
187 | |||
188 | def visitFor(self, node): |
|
188 | def visitFor(self, node): | |
189 | self.doSuite(node, node.body) |
|
189 | self.doSuite(node, node.body) | |
190 | self.doElse(node.body, node) |
|
190 | self.doElse(node.body, node) | |
@@ -216,11 +216,11 b' class StatementFindingAstVisitor(compile' | |||||
216 | else: |
|
216 | else: | |
217 | self.doSuite(a, h) |
|
217 | self.doSuite(a, h) | |
218 | self.doElse(node.handlers[-1][2], node) |
|
218 | self.doElse(node.handlers[-1][2], node) | |
219 |
|
219 | |||
220 | def visitTryFinally(self, node): |
|
220 | def visitTryFinally(self, node): | |
221 | self.doSuite(node, node.body) |
|
221 | self.doSuite(node, node.body) | |
222 | self.doPlainWordSuite(node.body, node.final) |
|
222 | self.doPlainWordSuite(node.body, node.final) | |
223 |
|
223 | |||
224 | def visitGlobal(self, node): |
|
224 | def visitGlobal(self, node): | |
225 | # "global" statements don't execute like others (they don't call the |
|
225 | # "global" statements don't execute like others (they don't call the | |
226 | # trace function), so don't record their line numbers. |
|
226 | # trace function), so don't record their line numbers. | |
@@ -240,7 +240,7 b' class coverage:' | |||||
240 | # A dictionary with an entry for (Python source file name, line number |
|
240 | # A dictionary with an entry for (Python source file name, line number | |
241 | # in that file) if that line has been executed. |
|
241 | # in that file) if that line has been executed. | |
242 | c = {} |
|
242 | c = {} | |
243 |
|
243 | |||
244 | # A map from canonical Python source file name to a dictionary in |
|
244 | # A map from canonical Python source file name to a dictionary in | |
245 | # which there's an entry for each line number that has been |
|
245 | # which there's an entry for each line number that has been | |
246 | # executed. |
|
246 | # executed. | |
@@ -266,12 +266,12 b' class coverage:' | |||||
266 | self.xstack = [] |
|
266 | self.xstack = [] | |
267 | self.relative_dir = os.path.normcase(os.path.abspath(os.curdir)+os.path.sep) |
|
267 | self.relative_dir = os.path.normcase(os.path.abspath(os.curdir)+os.path.sep) | |
268 |
|
268 | |||
269 |
# t(f, x, y). This method is passed to sys.settrace as a trace function. |
|
269 | # t(f, x, y). This method is passed to sys.settrace as a trace function. | |
270 |
# See [van Rossum 2001-07-20b, 9.2] for an explanation of sys.settrace and |
|
270 | # See [van Rossum 2001-07-20b, 9.2] for an explanation of sys.settrace and | |
271 | # the arguments and return value of the trace function. |
|
271 | # the arguments and return value of the trace function. | |
272 | # See [van Rossum 2001-07-20a, 3.2] for a description of frame and code |
|
272 | # See [van Rossum 2001-07-20a, 3.2] for a description of frame and code | |
273 | # objects. |
|
273 | # objects. | |
274 |
|
274 | |||
275 | def t(self, f, w, a): #pragma: no cover |
|
275 | def t(self, f, w, a): #pragma: no cover | |
276 | #print w, f.f_code.co_filename, f.f_lineno |
|
276 | #print w, f.f_code.co_filename, f.f_lineno | |
277 | if w == 'line': |
|
277 | if w == 'line': | |
@@ -279,7 +279,7 b' class coverage:' | |||||
279 | for c in self.cstack: |
|
279 | for c in self.cstack: | |
280 | c[(f.f_code.co_filename, f.f_lineno)] = 1 |
|
280 | c[(f.f_code.co_filename, f.f_lineno)] = 1 | |
281 | return self.t |
|
281 | return self.t | |
282 |
|
282 | |||
283 | def help(self, error=None): |
|
283 | def help(self, error=None): | |
284 | if error: |
|
284 | if error: | |
285 | print error |
|
285 | print error | |
@@ -330,7 +330,7 b' class coverage:' | |||||
330 | self.help("You must specify at least one of -e, -x, -r, or -a.") |
|
330 | self.help("You must specify at least one of -e, -x, -r, or -a.") | |
331 | if not args_needed and args: |
|
331 | if not args_needed and args: | |
332 | self.help("Unexpected arguments %s." % args) |
|
332 | self.help("Unexpected arguments %s." % args) | |
333 |
|
333 | |||
334 | self.get_ready() |
|
334 | self.get_ready() | |
335 | self.exclude('#pragma[: ]+[nN][oO] [cC][oO][vV][eE][rR]') |
|
335 | self.exclude('#pragma[: ]+[nN][oO] [cC][oO][vV][eE][rR]') | |
336 |
|
336 | |||
@@ -359,14 +359,14 b' class coverage:' | |||||
359 |
|
359 | |||
360 | def use_cache(self, usecache): |
|
360 | def use_cache(self, usecache): | |
361 | self.usecache = usecache |
|
361 | self.usecache = usecache | |
362 |
|
362 | |||
363 | def get_ready(self): |
|
363 | def get_ready(self): | |
364 | if self.usecache and not self.cache: |
|
364 | if self.usecache and not self.cache: | |
365 | self.cache = os.path.abspath(os.environ.get(self.cache_env, |
|
365 | self.cache = os.path.abspath(os.environ.get(self.cache_env, | |
366 | self.cache_default)) |
|
366 | self.cache_default)) | |
367 | self.restore() |
|
367 | self.restore() | |
368 | self.analysis_cache = {} |
|
368 | self.analysis_cache = {} | |
369 |
|
369 | |||
370 | def start(self): |
|
370 | def start(self): | |
371 | self.get_ready() |
|
371 | self.get_ready() | |
372 | if self.nesting == 0: #pragma: no cover |
|
372 | if self.nesting == 0: #pragma: no cover | |
@@ -374,7 +374,7 b' class coverage:' | |||||
374 | if hasattr(threading, 'settrace'): |
|
374 | if hasattr(threading, 'settrace'): | |
375 | threading.settrace(self.t) |
|
375 | threading.settrace(self.t) | |
376 | self.nesting += 1 |
|
376 | self.nesting += 1 | |
377 |
|
377 | |||
378 | def stop(self): |
|
378 | def stop(self): | |
379 | self.nesting -= 1 |
|
379 | self.nesting -= 1 | |
380 | if self.nesting == 0: #pragma: no cover |
|
380 | if self.nesting == 0: #pragma: no cover | |
@@ -398,7 +398,7 b' class coverage:' | |||||
398 | def begin_recursive(self): |
|
398 | def begin_recursive(self): | |
399 | self.cstack.append(self.c) |
|
399 | self.cstack.append(self.c) | |
400 | self.xstack.append(self.exclude_re) |
|
400 | self.xstack.append(self.exclude_re) | |
401 |
|
401 | |||
402 | def end_recursive(self): |
|
402 | def end_recursive(self): | |
403 | self.c = self.cstack.pop() |
|
403 | self.c = self.cstack.pop() | |
404 | self.exclude_re = self.xstack.pop() |
|
404 | self.exclude_re = self.xstack.pop() | |
@@ -452,7 +452,7 b' class coverage:' | |||||
452 | self.canonical_filename_cache[filename] = cf |
|
452 | self.canonical_filename_cache[filename] = cf | |
453 | return self.canonical_filename_cache[filename] |
|
453 | return self.canonical_filename_cache[filename] | |
454 |
|
454 | |||
455 |
# canonicalize_filenames(). Copy results from "c" to "cexecuted", |
|
455 | # canonicalize_filenames(). Copy results from "c" to "cexecuted", | |
456 | # canonicalizing filenames on the way. Clear the "c" map. |
|
456 | # canonicalizing filenames on the way. Clear the "c" map. | |
457 |
|
457 | |||
458 | def canonicalize_filenames(self): |
|
458 | def canonicalize_filenames(self): | |
@@ -550,7 +550,7 b' class coverage:' | |||||
550 | import parser |
|
550 | import parser | |
551 | tree = parser.suite(text+'\n\n').totuple(1) |
|
551 | tree = parser.suite(text+'\n\n').totuple(1) | |
552 | self.get_suite_spots(tree, suite_spots) |
|
552 | self.get_suite_spots(tree, suite_spots) | |
553 |
|
553 | |||
554 | # Use the compiler module to parse the text and find the executable |
|
554 | # Use the compiler module to parse the text and find the executable | |
555 | # statements. We add newlines to be impervious to final partial lines. |
|
555 | # statements. We add newlines to be impervious to final partial lines. | |
556 | statements = {} |
|
556 | statements = {} | |
@@ -713,7 +713,7 b' class coverage:' | |||||
713 | except: |
|
713 | except: | |
714 | if not ignore_errors: |
|
714 | if not ignore_errors: | |
715 | raise |
|
715 | raise | |
716 |
|
716 | |||
717 | def annotate_file(self, filename, statements, excluded, missing, directory=None): |
|
717 | def annotate_file(self, filename, statements, excluded, missing, directory=None): | |
718 | source = open(filename, 'r') |
|
718 | source = open(filename, 'r') | |
719 | if directory: |
|
719 | if directory: | |
@@ -741,7 +741,7 b' class coverage:' | |||||
741 | if self.blank_re.match(line): |
|
741 | if self.blank_re.match(line): | |
742 | dest.write(' ') |
|
742 | dest.write(' ') | |
743 | elif self.else_re.match(line): |
|
743 | elif self.else_re.match(line): | |
744 |
# Special logic for lines containing only 'else:'. |
|
744 | # Special logic for lines containing only 'else:'. | |
745 | # See [GDR 2001-12-04b, 3.2]. |
|
745 | # See [GDR 2001-12-04b, 3.2]. | |
746 | if i >= len(statements) and j >= len(missing): |
|
746 | if i >= len(statements) and j >= len(missing): | |
747 | dest.write('! ') |
|
747 | dest.write('! ') | |
@@ -850,7 +850,7 b" if __name__ == '__main__':" | |||||
850 | # Thanks, Allen. |
|
850 | # Thanks, Allen. | |
851 | # |
|
851 | # | |
852 | # 2005-12-02 NMB Call threading.settrace so that all threads are measured. |
|
852 | # 2005-12-02 NMB Call threading.settrace so that all threads are measured. | |
853 |
# Thanks Martin Fuzzey. Add a file argument to report so that reports can be |
|
853 | # Thanks Martin Fuzzey. Add a file argument to report so that reports can be | |
854 | # captured to a different destination. |
|
854 | # captured to a different destination. | |
855 | # |
|
855 | # | |
856 | # 2005-12-03 NMB coverage.py can now measure itself. |
|
856 | # 2005-12-03 NMB coverage.py can now measure itself. |
@@ -16,7 +16,7 b' for filename in sys.argv[1:]:' | |||||
16 | except IOError, msg: |
|
16 | except IOError, msg: | |
17 | sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) |
|
17 | sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) | |
18 | sys.exit(1) |
|
18 | sys.exit(1) | |
19 |
|
19 | |||
20 | m = md5.new() |
|
20 | m = md5.new() | |
21 | try: |
|
21 | try: | |
22 | while 1: |
|
22 | while 1: |
@@ -104,7 +104,7 b' def use_correct_python():' | |||||
104 | # windows fallback |
|
104 | # windows fallback | |
105 | shutil.copyfile(sys.executable, my_python) |
|
105 | shutil.copyfile(sys.executable, my_python) | |
106 | shutil.copymode(sys.executable, my_python) |
|
106 | shutil.copymode(sys.executable, my_python) | |
107 |
|
107 | |||
108 | def install_hg(): |
|
108 | def install_hg(): | |
109 | vlog("# Performing temporary installation of HG") |
|
109 | vlog("# Performing temporary installation of HG") | |
110 | installerrs = os.path.join("tests", "install.err") |
|
110 | installerrs = os.path.join("tests", "install.err") | |
@@ -358,7 +358,7 b' try:' | |||||
358 | args = os.listdir(".") |
|
358 | args = os.listdir(".") | |
359 | for test in args: |
|
359 | for test in args: | |
360 | if (test.startswith("test-") and '~' not in test and |
|
360 | if (test.startswith("test-") and '~' not in test and | |
361 |
('.' not in test or test.endswith('.py') or |
|
361 | ('.' not in test or test.endswith('.py') or | |
362 | test.endswith('.bat'))): |
|
362 | test.endswith('.bat'))): | |
363 | ret = run_one(test) |
|
363 | ret = run_one(test) | |
364 | if ret is None: |
|
364 | if ret is None: |
General Comments 0
You need to be logged in to leave comments.
Login now