Mercurial > hgsubversion
comparison fetch_command.py @ 90:4c419603d41b
fetch_command: create branch temporary directory when we need it
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Fri, 14 Nov 2008 16:18:24 -0600 |
| parents | edeec6829d80 |
| children | 0d3a2a7cefa3 |
comparison
equal
deleted
inserted
replaced
| 89:edeec6829d80 | 90:4c419603d41b |
|---|---|
| 358 branches = hg_editor.branches_in_paths(r.paths) | 358 branches = hg_editor.branches_in_paths(r.paths) |
| 359 temp_location = os.path.join(hg_editor.path, '.hg', 'svn', 'temp') | 359 temp_location = os.path.join(hg_editor.path, '.hg', 'svn', 'temp') |
| 360 if not os.path.exists(temp_location): | 360 if not os.path.exists(temp_location): |
| 361 os.makedirs(temp_location) | 361 os.makedirs(temp_location) |
| 362 for b in branches: | 362 for b in branches: |
| 363 our_tempdir = tempfile.mkdtemp('svn_fetch_temp', dir=temp_location) | 363 our_tempdir = None |
| 364 diff_path = make_diff_path(b) | 364 diff_path = make_diff_path(b) |
| 365 parent_rev, br_p = hg_editor.get_parent_svn_branch_and_rev(r.revnum, b) | 365 parent_rev, br_p = hg_editor.get_parent_svn_branch_and_rev(r.revnum, b) |
| 366 parent_ha = hg_editor.get_parent_revision(r.revnum, b) | 366 parent_ha = hg_editor.get_parent_revision(r.revnum, b) |
| 367 files_touched = set() | 367 files_touched = set() |
| 368 link_files = {} | 368 link_files = {} |
| 380 deleted=True, ignore_type=True) | 380 deleted=True, ignore_type=True) |
| 381 if d: | 381 if d: |
| 382 ui.status('Branch creation with mods, pulling full rev.\n') | 382 ui.status('Branch creation with mods, pulling full rev.\n') |
| 383 raise BadPatchApply() | 383 raise BadPatchApply() |
| 384 | 384 |
| 385 our_tempdir = tempfile.mkdtemp('svn_fetch_temp', dir=temp_location) | |
| 385 for m in binary_file_re.findall(d): | 386 for m in binary_file_re.findall(d): |
| 386 # we have to pull each binary file by hand as a fulltext, | 387 # we have to pull each binary file by hand as a fulltext, |
| 387 # which sucks but we've got no choice | 388 # which sucks but we've got no choice |
| 388 file_path = os.path.join(our_tempdir, m) | 389 file_path = os.path.join(our_tempdir, m) |
| 389 files_touched.add(m) | 390 files_touched.add(m) |
| 580 ha = hg_editor.repo.commitctx(current_ctx) | 581 ha = hg_editor.repo.commitctx(current_ctx) |
| 581 hg_editor.add_to_revmap(r.revnum, b, ha) | 582 hg_editor.add_to_revmap(r.revnum, b, ha) |
| 582 hg_editor._save_metadata() | 583 hg_editor._save_metadata() |
| 583 ui.status('committed as %s on branch %s\n' % | 584 ui.status('committed as %s on branch %s\n' % |
| 584 (node.hex(ha), b or 'default')) | 585 (node.hex(ha), b or 'default')) |
| 585 shutil.rmtree(our_tempdir) | 586 if our_tempdir is not None: |
| 587 shutil.rmtree(our_tempdir) | |
| 586 | 588 |
| 587 | 589 |
| 588 class BadPatchApply(Exception): | 590 class BadPatchApply(Exception): |
| 589 pass | 591 pass |
