comparison mercurial/commands.py @ 1250:0ad3f9b27260

Merge with MPM.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 14 Sep 2005 14:39:46 -0700
parents a5355fa5e33a 937ee88da3ef
children a45e717c61a8
comparison
equal deleted inserted replaced
1249:a5355fa5e33a 1250:0ad3f9b27260
577 # assume all revision numbers are for changesets 577 # assume all revision numbers are for changesets
578 n = repo.lookup(rev) 578 n = repo.lookup(rev)
579 change = repo.changelog.read(n) 579 change = repo.changelog.read(n)
580 m = repo.manifest.read(change[0]) 580 m = repo.manifest.read(change[0])
581 n = m[relpath(repo, [file1])[0]] 581 n = m[relpath(repo, [file1])[0]]
582 except hg.RepoError, KeyError: 582 except (hg.RepoError, KeyError):
583 n = r.lookup(rev) 583 try:
584 n = r.lookup(rev)
585 except KeyError, inst:
586 raise util.Abort('cannot find file %s in rev %s', file1, rev)
584 else: 587 else:
585 n = r.tip() 588 n = r.tip()
586 fp = make_file(repo, r, opts['output'], node=n) 589 fp = make_file(repo, r, opts['output'], node=n)
587 fp.write(r.read(n)) 590 fp.write(r.read(n))
588 591
616 if not os.path.exists(source): 619 if not os.path.exists(source):
617 source = ui.expandpath(source) 620 source = ui.expandpath(source)
618 abspath = source 621 abspath = source
619 other = hg.repository(ui, source) 622 other = hg.repository(ui, source)
620 623
624 copy = False
621 if other.dev() != -1: 625 if other.dev() != -1:
622 abspath = os.path.abspath(source) 626 abspath = os.path.abspath(source)
623 627 copy = True
624 # we use a lock here because if we race with commit, we can 628
625 # end up with extra data in the cloned revlogs that's not 629 if copy:
626 # pointed to by changesets, thus causing verify to fail 630 try:
627 l1 = lock.lock(os.path.join(source, ".hg", "lock")) 631 # we use a lock here because if we race with commit, we
628 632 # can end up with extra data in the cloned revlogs that's
629 # and here to avoid premature writing to the target 633 # not pointed to by changesets, thus causing verify to
634 # fail
635 l1 = lock.lock(os.path.join(source, ".hg", "lock"))
636 except OSError:
637 copy = False
638
639 if copy:
640 # we lock here to avoid premature writing to the target
630 os.mkdir(os.path.join(dest, ".hg")) 641 os.mkdir(os.path.join(dest, ".hg"))
631 l2 = lock.lock(os.path.join(dest, ".hg", "lock")) 642 l2 = lock.lock(os.path.join(dest, ".hg", "lock"))
632 643
633 files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i" 644 files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i"
634 for f in files.split(): 645 for f in files.split():