Mercurial > hgsubversion
comparison fetch_command.py @ 119:ea65fe2b0856
hg_delta_editor: fix update of stray files in branches/
Ensure that self.current_file is a non-empty path in a branch.
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Sat, 29 Nov 2008 11:25:01 -0600 |
| parents | a0401f6e14dd |
| children | 7e45bcf52b64 |
comparison
equal
deleted
inserted
replaced
| 118:a0401f6e14dd | 119:ea65fe2b0856 |
|---|---|
| 421 | 421 |
| 422 Return a tuple (files, filectxfn) where 'files' is the list of all files | 422 Return a tuple (files, filectxfn) where 'files' is the list of all files |
| 423 in the branch at the given revision, and 'filectxfn' is a memctx compatible | 423 in the branch at the given revision, and 'filectxfn' is a memctx compatible |
| 424 callable to retrieve individual file information. | 424 callable to retrieve individual file information. |
| 425 """ | 425 """ |
| 426 kind = svn.checkpath(branchpath, r.revnum) | |
| 427 if kind != 'd': | |
| 428 # Branch does not exist at this revision. Get parent revision and | |
| 429 # remove everything. | |
| 430 files = parentctx.manifest().keys() | |
| 431 def filectxfn_rm(repo, memctx, path): | |
| 432 raise IOError() | |
| 433 return files, filectxfn_rm | |
| 434 | |
| 435 files = [] | 426 files = [] |
| 436 if parentctx.node() == revlog.nullid: | 427 if parentctx.node() == revlog.nullid: |
| 437 # Initial revision, fetch all files | 428 # Initial revision, fetch all files |
| 438 for path, kind in svn.list_files(branchpath, r.revnum): | 429 for path, kind in svn.list_files(branchpath, r.revnum): |
| 439 if kind == 'f': | 430 if kind == 'f': |
| 483 if not os.path.exists(temp_location): | 474 if not os.path.exists(temp_location): |
| 484 os.makedirs(temp_location) | 475 os.makedirs(temp_location) |
| 485 for b in branches: | 476 for b in branches: |
| 486 our_tempdir = tempfile.mkdtemp('svn_fetch_temp', dir=temp_location) | 477 our_tempdir = tempfile.mkdtemp('svn_fetch_temp', dir=temp_location) |
| 487 parentctx = hg_editor.repo[hg_editor.get_parent_revision(r.revnum, b)] | 478 parentctx = hg_editor.repo[hg_editor.get_parent_revision(r.revnum, b)] |
| 488 try: | 479 kind = svn.checkpath(branches[b], r.revnum) |
| 489 files_touched, filectxfn = stupid_diff_branchrev( | 480 if kind != 'd': |
| 490 ui, svn, hg_editor, b, r, parentctx, our_tempdir) | 481 # Branch does not exist at this revision. Get parent revision and |
| 491 except BadPatchApply, e: | 482 # remove everything. |
| 492 # Either this revision or the previous one does not exist. | 483 files_touched = parentctx.manifest().keys() |
| 493 ui.status("fetching entire rev: %s.\n" % e.message) | 484 def filectxfn(repo, memctx, path): |
| 494 files_touched, filectxfn = stupid_fetch_branchrev( | 485 raise IOError() |
| 495 svn, hg_editor, b, branches[b], r, parentctx) | 486 else: |
| 487 try: | |
| 488 files_touched, filectxfn = stupid_diff_branchrev( | |
| 489 ui, svn, hg_editor, b, r, parentctx, our_tempdir) | |
| 490 except BadPatchApply, e: | |
| 491 # Either this revision or the previous one does not exist. | |
| 492 ui.status("fetching entire rev: %s.\n" % e.message) | |
| 493 files_touched, filectxfn = stupid_fetch_branchrev( | |
| 494 svn, hg_editor, b, branches[b], r, parentctx) | |
| 496 | 495 |
| 497 date = r.date.replace('T', ' ').replace('Z', '').split('.')[0] | 496 date = r.date.replace('T', ' ').replace('Z', '').split('.')[0] |
| 498 date += ' -0000' | 497 date += ' -0000' |
| 499 extra = {} | 498 extra = {} |
| 500 if b: | 499 if b: |
