~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-19 08:54:42 UTC
  • mfrom: (1733.2.6 mpe)
  • Revision ID: pqm@pqm.ubuntu.com-20060619085442-78ad2b3effaba541
(mpe) show plugin name in help; ancestry takes branch argument

Show diffs side-by-side

added added

removed removed

Lines of Context:
941
941
 
942
942
 
943
943
class cmd_revision_history(Command):
944
 
    """Display list of revision ids on this branch."""
 
944
    """Display the list of revision ids on a branch."""
 
945
    takes_args = ['location?']
 
946
 
945
947
    hidden = True
946
948
 
947
949
    @display_command
948
 
    def run(self):
949
 
        branch = WorkingTree.open_containing(u'.')[0].branch
950
 
        for patchid in branch.revision_history():
951
 
            self.outf.write(patchid)
 
950
    def run(self, location="."):
 
951
        branch = Branch.open_containing(location)[0]
 
952
        for revid in branch.revision_history():
 
953
            self.outf.write(revid)
952
954
            self.outf.write('\n')
953
955
 
954
956
 
955
957
class cmd_ancestry(Command):
956
958
    """List all revisions merged into this branch."""
 
959
    takes_args = ['location?']
 
960
 
957
961
    hidden = True
958
962
 
959
963
    @display_command
960
 
    def run(self):
961
 
        tree = WorkingTree.open_containing(u'.')[0]
962
 
        b = tree.branch
963
 
        # FIXME. should be tree.last_revision
964
 
        revision_ids = b.repository.get_ancestry(b.last_revision())
 
964
    def run(self, location="."):
 
965
        try:
 
966
            wt = WorkingTree.open_containing(location)[0]
 
967
        except errors.NoWorkingTree:
 
968
            b = Branch.open(location)
 
969
            last_revision = b.last_revision()
 
970
        else:
 
971
            b = wt.branch
 
972
            last_revision = wt.last_revision()
 
973
 
 
974
        revision_ids = b.repository.get_ancestry(last_revision)
965
975
        assert revision_ids[0] == None
966
976
        revision_ids.pop(0)
967
977
        for revision_id in revision_ids: