~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Aaron Bentley
  • Date: 2005-09-19 02:52:24 UTC
  • mto: (1185.1.29)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: aaron.bentley@utoronto.ca-20050919025224-1cc3c70640086e09
TODO re tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
898
898
        from bzrlib.commit import commit
899
899
        commit(self, *args, **kw)
900
900
        
 
901
 
 
902
 
901
903
    def revision_id_to_revno(self, revision_id):
902
904
        """Given a revision id, return its revno"""
903
905
        history = self.revision_history()
906
908
        except ValueError:
907
909
            raise bzrlib.errors.NoSuchRevision(self, revision_id)
908
910
 
 
911
 
909
912
    def get_rev_id(self, revno, history=None):
910
913
        """Find the revision id of the specified revno."""
911
914
        if revno == 0:
1331
1334
    return gen_file_id('TREE_ROOT')
1332
1335
 
1333
1336
 
1334
 
def copy_branch(branch_from, to_location, revno=None):
 
1337
def copy_branch(branch_from, to_location, revision=None):
1335
1338
    """Copy branch_from into the existing directory to_location.
1336
1339
 
1337
1340
    revision
1342
1345
        The name of a local directory that exists but is empty.
1343
1346
    """
1344
1347
    from bzrlib.merge import merge
 
1348
    from bzrlib.revisionspec import RevisionSpec
1345
1349
 
1346
1350
    assert isinstance(branch_from, Branch)
1347
1351
    assert isinstance(to_location, basestring)
1348
1352
    
1349
1353
    br_to = Branch.initialize(to_location)
1350
1354
    br_to.set_root_id(branch_from.get_root_id())
1351
 
    if revno is None:
 
1355
    if revision is None:
1352
1356
        revno = branch_from.revno()
 
1357
    else:
 
1358
        revno, rev_id = RevisionSpec(revision).in_history(branch_from)
1353
1359
    br_to.update_revisions(branch_from, stop_revision=revno)
1354
1360
    merge((to_location, -1), (to_location, 0), this_dir=to_location,
1355
1361
          check_clean=False, ignore_zero=True)