Show More
@@ -148,7 +148,7 b' class filemap_source(converter_source):' | |||||
148 | # wanted by previous runs. |
|
148 | # wanted by previous runs. | |
149 | self._rebuilt = not revmap |
|
149 | self._rebuilt = not revmap | |
150 | seen = {SKIPREV: SKIPREV} |
|
150 | seen = {SKIPREV: SKIPREV} | |
151 |
dummyset = |
|
151 | dummyset = set() | |
152 | converted = [] |
|
152 | converted = [] | |
153 | for rev in revmap.order: |
|
153 | for rev in revmap.order: | |
154 | mapped = revmap[rev] |
|
154 | mapped = revmap[rev] | |
@@ -237,7 +237,7 b' class filemap_source(converter_source):' | |||||
237 | # map to any revision in the restricted graph. Put SKIPREV |
|
237 | # map to any revision in the restricted graph. Put SKIPREV | |
238 | # in the set of wanted ancestors to simplify code elsewhere |
|
238 | # in the set of wanted ancestors to simplify code elsewhere | |
239 | self.parentmap[rev] = SKIPREV |
|
239 | self.parentmap[rev] = SKIPREV | |
240 |
self.wantedancestors[rev] = |
|
240 | self.wantedancestors[rev] = set((SKIPREV,)) | |
241 | return |
|
241 | return | |
242 |
|
242 | |||
243 | # Reuse the data from our parent. |
|
243 | # Reuse the data from our parent. | |
@@ -254,7 +254,7 b' class filemap_source(converter_source):' | |||||
254 |
|
254 | |||
255 | # The set of wanted ancestors of rev is the union of the sets |
|
255 | # The set of wanted ancestors of rev is the union of the sets | |
256 | # of wanted ancestors of its parents. Plus rev itself. |
|
256 | # of wanted ancestors of its parents. Plus rev itself. | |
257 |
wrev = |
|
257 | wrev = set() | |
258 | for p in parents: |
|
258 | for p in parents: | |
259 | wrev.update(self.wantedancestors[p]) |
|
259 | wrev.update(self.wantedancestors[p]) | |
260 | wrev.add(rev) |
|
260 | wrev.add(rev) |
@@ -564,7 +564,7 b' class svn_source(converter_source):' | |||||
564 | out, e.g. 'I copied trunk into a subdirectory of itself instead |
|
564 | out, e.g. 'I copied trunk into a subdirectory of itself instead | |
565 | of making a branch'. The converted repository is significantly |
|
565 | of making a branch'. The converted repository is significantly | |
566 | smaller if we ignore such revisions.""" |
|
566 | smaller if we ignore such revisions.""" | |
567 |
self.blacklist = |
|
567 | self.blacklist = set() | |
568 | blacklist = self.blacklist |
|
568 | blacklist = self.blacklist | |
569 | for line in file("blacklist.txt", "r"): |
|
569 | for line in file("blacklist.txt", "r"): | |
570 | if not line.startswith("#"): |
|
570 | if not line.startswith("#"): | |
@@ -1099,7 +1099,7 b' class svn_sink(converter_sink, commandli' | |||||
1099 | os.rename(tempname, wdest) |
|
1099 | os.rename(tempname, wdest) | |
1100 |
|
1100 | |||
1101 | def dirs_of(self, files): |
|
1101 | def dirs_of(self, files): | |
1102 |
dirs = |
|
1102 | dirs = set() | |
1103 | for f in files: |
|
1103 | for f in files: | |
1104 | if os.path.isdir(self.wjoin(f)): |
|
1104 | if os.path.isdir(self.wjoin(f)): | |
1105 | dirs.add(f) |
|
1105 | dirs.add(f) | |
@@ -1155,8 +1155,8 b' class svn_sink(converter_sink, commandli' | |||||
1155 | return self.revid(self.childmap[parent]) |
|
1155 | return self.revid(self.childmap[parent]) | |
1156 | except KeyError: |
|
1156 | except KeyError: | |
1157 | pass |
|
1157 | pass | |
1158 |
entries = |
|
1158 | entries = set(self.delete) | |
1159 |
files = |
|
1159 | files = frozenset(files) | |
1160 | entries.update(self.add_dirs(files.difference(entries))) |
|
1160 | entries.update(self.add_dirs(files.difference(entries))) | |
1161 | if self.copies: |
|
1161 | if self.copies: | |
1162 | for s, d in self.copies: |
|
1162 | for s, d in self.copies: |
@@ -286,7 +286,7 b' def graphlog(ui, repo, path=None, **opts' | |||||
286 |
|
286 | |||
287 | def graphrevs(repo, nodes, opts): |
|
287 | def graphrevs(repo, nodes, opts): | |
288 | nodes.reverse() |
|
288 | nodes.reverse() | |
289 |
include = |
|
289 | include = set(nodes) | |
290 | limit = cmdutil.loglimit(opts) |
|
290 | limit = cmdutil.loglimit(opts) | |
291 | count = 0 |
|
291 | count = 0 | |
292 | for node in nodes: |
|
292 | for node in nodes: |
@@ -128,8 +128,8 b' def rebase(ui, repo, **opts):' | |||||
128 |
|
128 | |||
129 | if not keepf: |
|
129 | if not keepf: | |
130 | # Remove no more useful revisions |
|
130 | # Remove no more useful revisions | |
131 |
if ( |
|
131 | if (set(repo.changelog.descendants(min(state))) | |
132 |
- |
|
132 | - set(state.keys())): | |
133 | ui.warn(_("warning: new changesets detected on source branch, " |
|
133 | ui.warn(_("warning: new changesets detected on source branch, " | |
134 | "not stripping\n")) |
|
134 | "not stripping\n")) | |
135 | else: |
|
135 | else: | |
@@ -353,7 +353,7 b' def restorestatus(repo):' | |||||
353 |
|
353 | |||
354 | def abort(repo, originalwd, target, state): |
|
354 | def abort(repo, originalwd, target, state): | |
355 | 'Restore the repository to its original state' |
|
355 | 'Restore the repository to its original state' | |
356 |
if |
|
356 | if set(repo.changelog.descendants(target)) - set(state.values()): | |
357 | repo.ui.warn(_("warning: new changesets detected on target branch, " |
|
357 | repo.ui.warn(_("warning: new changesets detected on target branch, " | |
358 | "not stripping\n")) |
|
358 | "not stripping\n")) | |
359 | else: |
|
359 | else: | |
@@ -368,7 +368,7 b' def abort(repo, originalwd, target, stat' | |||||
368 |
|
368 | |||
369 | def buildstate(repo, dest, src, base, collapse): |
|
369 | def buildstate(repo, dest, src, base, collapse): | |
370 | 'Define which revisions are going to be rebased and where' |
|
370 | 'Define which revisions are going to be rebased and where' | |
371 |
targetancestors = |
|
371 | targetancestors = set() | |
372 |
|
372 | |||
373 | if not dest: |
|
373 | if not dest: | |
374 | # Destination defaults to the latest revision in the current branch |
|
374 | # Destination defaults to the latest revision in the current branch | |
@@ -397,12 +397,12 b' def buildstate(repo, dest, src, base, co' | |||||
397 | repo.ui.debug(_('already working on current\n')) |
|
397 | repo.ui.debug(_('already working on current\n')) | |
398 | return None |
|
398 | return None | |
399 |
|
399 | |||
400 |
targetancestors = |
|
400 | targetancestors = set(repo.changelog.ancestors(dest)) | |
401 | if cwd in targetancestors: |
|
401 | if cwd in targetancestors: | |
402 | repo.ui.debug(_('already working on the current branch\n')) |
|
402 | repo.ui.debug(_('already working on the current branch\n')) | |
403 | return None |
|
403 | return None | |
404 |
|
404 | |||
405 |
cwdancestors = |
|
405 | cwdancestors = set(repo.changelog.ancestors(cwd)) | |
406 | cwdancestors.add(cwd) |
|
406 | cwdancestors.add(cwd) | |
407 | rebasingbranch = cwdancestors - targetancestors |
|
407 | rebasingbranch = cwdancestors - targetancestors | |
408 | source = min(rebasingbranch) |
|
408 | source = min(rebasingbranch) | |
@@ -412,7 +412,7 b' def buildstate(repo, dest, src, base, co' | |||||
412 | external = nullrev |
|
412 | external = nullrev | |
413 | if collapse: |
|
413 | if collapse: | |
414 | if not targetancestors: |
|
414 | if not targetancestors: | |
415 |
targetancestors = |
|
415 | targetancestors = set(repo.changelog.ancestors(dest)) | |
416 | for rev in state: |
|
416 | for rev in state: | |
417 | # Check externals and fail if there are more than one |
|
417 | # Check externals and fail if there are more than one | |
418 | for p in repo[rev].parents(): |
|
418 | for p in repo[rev].parents(): |
@@ -99,7 +99,7 b' def macencode(s, cmd):' | |||||
99 |
|
99 | |||
100 | def forbidnewline(ui, repo, hooktype, node, newline, **kwargs): |
|
100 | def forbidnewline(ui, repo, hooktype, node, newline, **kwargs): | |
101 | halt = False |
|
101 | halt = False | |
102 |
seen = |
|
102 | seen = set() | |
103 | # we try to walk changesets in reverse order from newest to |
|
103 | # we try to walk changesets in reverse order from newest to | |
104 | # oldest, so that if we see a file multiple times, we take the |
|
104 | # oldest, so that if we see a file multiple times, we take the | |
105 | # newest version as canonical. this prevents us from blocking a |
|
105 | # newest version as canonical. this prevents us from blocking a |
@@ -1306,7 +1306,7 b' def heads(ui, repo, *branchrevs, **opts)' | |||||
1306 | heads = repo.heads(start, closed=closed) |
|
1306 | heads = repo.heads(start, closed=closed) | |
1307 | else: |
|
1307 | else: | |
1308 | heads = [] |
|
1308 | heads = [] | |
1309 |
visitedset = |
|
1309 | visitedset = set() | |
1310 | for branchrev in branchrevs: |
|
1310 | for branchrev in branchrevs: | |
1311 | branch = repo[branchrev].branch() |
|
1311 | branch = repo[branchrev].branch() | |
1312 | if branch in visitedset: |
|
1312 | if branch in visitedset: |
@@ -52,9 +52,9 b' class httprepository(repo.repository):' | |||||
52 | def get_caps(self): |
|
52 | def get_caps(self): | |
53 | if self.caps is None: |
|
53 | if self.caps is None: | |
54 | try: |
|
54 | try: | |
55 |
self.caps = |
|
55 | self.caps = set(self.do_read('capabilities').split()) | |
56 | except error.RepoError: |
|
56 | except error.RepoError: | |
57 |
self.caps = |
|
57 | self.caps = set() | |
58 | self.ui.debug(_('capabilities: %s\n') % |
|
58 | self.ui.debug(_('capabilities: %s\n') % | |
59 | (' '.join(self.caps or ['none']))) |
|
59 | (' '.join(self.caps or ['none']))) | |
60 | return self.caps |
|
60 | return self.caps |
@@ -17,7 +17,7 b' import merge as merge_' | |||||
17 | from lock import release |
|
17 | from lock import release | |
18 |
|
18 | |||
19 | class localrepository(repo.repository): |
|
19 | class localrepository(repo.repository): | |
20 |
capabilities = |
|
20 | capabilities = set(('lookup', 'changegroupsubset')) | |
21 | supported = ('revlogv1', 'store', 'fncache') |
|
21 | supported = ('revlogv1', 'store', 'fncache') | |
22 |
|
22 | |||
23 | def __init__(self, parentui, path=None, create=0): |
|
23 | def __init__(self, parentui, path=None, create=0): |
@@ -576,7 +576,7 b' class revlog(object):' | |||||
576 | def ancestors(self, *revs): |
|
576 | def ancestors(self, *revs): | |
577 | 'Generate the ancestors of revs using a breadth-first visit' |
|
577 | 'Generate the ancestors of revs using a breadth-first visit' | |
578 | visit = list(revs) |
|
578 | visit = list(revs) | |
579 |
seen = |
|
579 | seen = set([nullrev]) | |
580 | while visit: |
|
580 | while visit: | |
581 | for parent in self.parentrevs(visit.pop(0)): |
|
581 | for parent in self.parentrevs(visit.pop(0)): | |
582 | if parent not in seen: |
|
582 | if parent not in seen: | |
@@ -586,7 +586,7 b' class revlog(object):' | |||||
586 |
|
586 | |||
587 | def descendants(self, *revs): |
|
587 | def descendants(self, *revs): | |
588 | 'Generate the descendants of revs in topological order' |
|
588 | 'Generate the descendants of revs in topological order' | |
589 |
seen = |
|
589 | seen = set(revs) | |
590 | for i in xrange(min(revs) + 1, len(self)): |
|
590 | for i in xrange(min(revs) + 1, len(self)): | |
591 | for x in self.parentrevs(i): |
|
591 | for x in self.parentrevs(i): | |
592 | if x != nullrev and x in seen: |
|
592 | if x != nullrev and x in seen: |
@@ -80,7 +80,7 b' class sshrepository(repo.repository):' | |||||
80 | else: |
|
80 | else: | |
81 | self.abort(error.RepoError(_("no suitable response from remote hg"))) |
|
81 | self.abort(error.RepoError(_("no suitable response from remote hg"))) | |
82 |
|
82 | |||
83 |
self.capabilities = |
|
83 | self.capabilities = set() | |
84 | lines.reverse() |
|
84 | lines.reverse() | |
85 | for l in lines: |
|
85 | for l in lines: | |
86 | if l.startswith("capabilities:"): |
|
86 | if l.startswith("capabilities:"): |
@@ -84,8 +84,8 b' def quotepath(path):' | |||||
84 | ''' |
|
84 | ''' | |
85 | global _safeset, _hex |
|
85 | global _safeset, _hex | |
86 | if _safeset is None: |
|
86 | if _safeset is None: | |
87 |
_safeset = |
|
87 | _safeset = set(_safe) | |
88 |
_hex = |
|
88 | _hex = set('abcdefABCDEF0123456789') | |
89 | l = list(path) |
|
89 | l = list(path) | |
90 | for i in xrange(len(l)): |
|
90 | for i in xrange(len(l)): | |
91 | c = l[i] |
|
91 | c = l[i] |
@@ -19,12 +19,6 b' import imp' | |||||
19 |
|
19 | |||
20 | # Python compatibility |
|
20 | # Python compatibility | |
21 |
|
21 | |||
22 | try: |
|
|||
23 | set = set |
|
|||
24 | frozenset = frozenset |
|
|||
25 | except NameError: |
|
|||
26 | from sets import Set as set, ImmutableSet as frozenset |
|
|||
27 |
|
||||
28 | _md5 = None |
|
22 | _md5 = None | |
29 | def md5(s): |
|
23 | def md5(s): | |
30 | global _md5 |
|
24 | global _md5 |
@@ -1,7 +1,7 b'' | |||||
1 | import os |
|
1 | import os | |
2 | import os.path |
|
2 | import os.path | |
3 | from mercurial import hg, ui |
|
3 | from mercurial import hg, ui | |
4 |
from mercurial.util import walkrepos |
|
4 | from mercurial.util import walkrepos | |
5 | from os import mkdir, chdir |
|
5 | from os import mkdir, chdir | |
6 | from os.path import join as pjoin |
|
6 | from os.path import join as pjoin | |
7 |
|
7 |
General Comments 0
You need to be logged in to leave comments.
Login now