Mercurial > hgsubversion
comparison fetch_command.py @ 101:a3b717e4abf5
Cleanups based on pyflakes output.
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Fri, 21 Nov 2008 16:21:19 -0600 |
| parents | c7ac013cf7fd |
| children | 3d56b8c53979 |
comparison
equal
deleted
inserted
replaced
| 100:91ce18fa0375 | 101:a3b717e4abf5 |
|---|---|
| 1 import cStringIO | 1 import cStringIO |
| 2 import re | 2 import re |
| 3 import operator | |
| 4 import os | 3 import os |
| 5 import shutil | 4 import shutil |
| 6 import tempfile | 5 import tempfile |
| 7 | 6 |
| 8 from mercurial import patch | 7 from mercurial import patch |
| 122 for p in hg_editor.missing_plaintexts: | 121 for p in hg_editor.missing_plaintexts: |
| 123 hg_editor.ui.status('.') | 122 hg_editor.ui.status('.') |
| 124 hg_editor.ui.flush() | 123 hg_editor.ui.flush() |
| 125 if p[-1] == '/': | 124 if p[-1] == '/': |
| 126 dirpath = p[len(rootpath):] | 125 dirpath = p[len(rootpath):] |
| 127 files_to_grab.update((dirpath + f for f,k in | 126 files_to_grab.update((dirpath + f for f,k in |
| 128 svn.list_files(p, r.revnum) if k == 'f')) | 127 svn.list_files(p, r.revnum) if k == 'f')) |
| 129 else: | 128 else: |
| 130 files_to_grab.add(p[len(rootpath):]) | 129 files_to_grab.add(p[len(rootpath):]) |
| 131 hg_editor.ui.status('\nFetching files...\n') | 130 hg_editor.ui.status('\nFetching files...\n') |
| 132 for p in files_to_grab: | 131 for p in files_to_grab: |
| 205 copies.append((dest, (source, e.copyfrom_rev))) | 204 copies.append((dest, (source, e.copyfrom_rev))) |
| 206 | 205 |
| 207 copies.sort() | 206 copies.sort() |
| 208 copies.reverse() | 207 copies.reverse() |
| 209 exactcopies = dict(copies) | 208 exactcopies = dict(copies) |
| 210 | 209 |
| 211 def finder(path): | 210 def finder(path): |
| 212 if path in exactcopies: | 211 if path in exactcopies: |
| 213 return exactcopies[path], exactcopies[path][0] | 212 return exactcopies[path], exactcopies[path][0] |
| 214 # look for parent directory copy, longest first | 213 # look for parent directory copy, longest first |
| 215 for dest, (source, sourcerev) in copies: | 214 for dest, (source, sourcerev) in copies: |
| 278 kind = svn.checkpath(branchpath, r.revnum) | 277 kind = svn.checkpath(branchpath, r.revnum) |
| 279 if kind is None: | 278 if kind is None: |
| 280 # Branch does not exist at this revision. Get parent revision and | 279 # Branch does not exist at this revision. Get parent revision and |
| 281 # remove everything. | 280 # remove everything. |
| 282 files = parentctx.manifest().keys() | 281 files = parentctx.manifest().keys() |
| 283 def filectxfn(repo, memctx, path): | 282 def filectxfn_rm(repo, memctx, path): |
| 284 raise IOError() | 283 raise IOError() |
| 285 return files, filectxfn | 284 return files, filectxfn_rm |
| 286 | 285 |
| 287 files = [] | 286 files = [] |
| 288 if parentid == revlog.nullid: | 287 if parentid == revlog.nullid: |
| 289 # Initial revision, fetch all files | 288 # Initial revision, fetch all files |
| 290 for path, kind in svn.list_files(branchpath, r.revnum): | 289 for path, kind in svn.list_files(branchpath, r.revnum): |
| 312 files.append(path) | 311 files.append(path) |
| 313 continue | 312 continue |
| 314 # Assume it's a deleted directory | 313 # Assume it's a deleted directory |
| 315 path = path + '/' | 314 path = path + '/' |
| 316 deleted = [f for f in parentctx if f.startswith(path)] | 315 deleted = [f for f in parentctx if f.startswith(path)] |
| 317 files += deleted | 316 files += deleted |
| 318 | 317 |
| 319 copies = getcopies(svn, hg_editor, branch, branchpath, r, files, parentid) | 318 copies = getcopies(svn, hg_editor, branch, branchpath, r, files, parentid) |
| 320 | 319 |
| 321 def filectxfn(repo, memctx, path): | 320 def filectxfn(repo, memctx, path): |
| 322 data, mode = svn.get_file(branchpath + '/' + path, r.revnum) | 321 data, mode = svn.get_file(branchpath + '/' + path, r.revnum) |
| 323 isexec = 'x' in mode | 322 isexec = 'x' in mode |
| 324 islink = 'l' in mode | 323 islink = 'l' in mode |
| 325 copied = copies.get(path) | 324 copied = copies.get(path) |
| 514 if delete_all_files: | 513 if delete_all_files: |
| 515 for p in hg_editor.repo[parent_ha].manifest().iterkeys(): | 514 for p in hg_editor.repo[parent_ha].manifest().iterkeys(): |
| 516 if p: | 515 if p: |
| 517 files_touched.add(p) | 516 files_touched.add(p) |
| 518 | 517 |
| 519 copies = getcopies(svn, hg_editor, b, branches[b], r, files_touched, | 518 copies = getcopies(svn, hg_editor, b, branches[b], r, files_touched, |
| 520 parent_ha) | 519 parent_ha) |
| 521 | 520 |
| 522 def filectxfn(repo, memctx, path): | 521 def filectxfn(repo, memctx, path): |
| 523 disk_path = os.path.join(our_tempdir, path) | 522 disk_path = os.path.join(our_tempdir, path) |
| 524 if path in link_files: | 523 if path in link_files: |
