~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Martin Pool
  • Date: 2008-05-02 02:31:14 UTC
  • mfrom: (3399 +trunk)
  • mto: (3408.1.1 doc)
  • mto: This revision was merged to the branch mainline in revision 3409.
  • Revision ID: mbp@sourcefrog.net-20080502023114-y2gcg3w3jc770j9m
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
669
669
                raise errors.BzrCommandError(
670
670
                    'bzr pull --revision takes one value.')
671
671
 
672
 
        if verbose:
673
 
            old_rh = branch_to.revision_history()
674
 
        if tree_to is not None:
675
 
            change_reporter = delta._ChangeReporter(
676
 
                unversioned_filter=tree_to.is_ignored)
677
 
            result = tree_to.pull(branch_from, overwrite, revision_id,
678
 
                                  change_reporter,
679
 
                                  possible_transports=possible_transports)
680
 
        else:
681
 
            result = branch_to.pull(branch_from, overwrite, revision_id)
 
672
        branch_to.lock_write()
 
673
        try:
 
674
            if tree_to is not None:
 
675
                change_reporter = delta._ChangeReporter(
 
676
                    unversioned_filter=tree_to.is_ignored)
 
677
                result = tree_to.pull(branch_from, overwrite, revision_id,
 
678
                                      change_reporter,
 
679
                                      possible_transports=possible_transports)
 
680
            else:
 
681
                result = branch_to.pull(branch_from, overwrite, revision_id)
682
682
 
683
 
        result.report(self.outf)
684
 
        if verbose:
685
 
            new_rh = branch_to.revision_history()
686
 
            log.show_changed_revisions(branch_to, old_rh, new_rh,
687
 
                                       to_file=self.outf)
 
683
            result.report(self.outf)
 
684
            if verbose and result.old_revid != result.new_revid:
 
685
                old_rh = list(
 
686
                    branch_to.repository.iter_reverse_revision_history(
 
687
                    result.old_revid))
 
688
                old_rh.reverse()
 
689
                new_rh = branch_to.revision_history()
 
690
                log.show_changed_revisions(branch_to, old_rh, new_rh,
 
691
                                           to_file=self.outf)
 
692
        finally:
 
693
            branch_to.unlock()
688
694
 
689
695
 
690
696
class cmd_push(Command):
2719
2725
    """Show version of bzr."""
2720
2726
 
2721
2727
    encoding_type = 'replace'
 
2728
    takes_options = [
 
2729
        Option("short", help="Print just the version number."),
 
2730
        ]
2722
2731
 
2723
2732
    @display_command
2724
 
    def run(self):
 
2733
    def run(self, short=False):
2725
2734
        from bzrlib.version import show_version
2726
 
        show_version(to_file=self.outf)
 
2735
        if short:
 
2736
            self.outf.write(bzrlib.version_string + '\n')
 
2737
        else:
 
2738
            show_version(to_file=self.outf)
2727
2739
 
2728
2740
 
2729
2741
class cmd_rocks(Command):
3659
3671
    specified revision.  For example, "bzr uncommit -r 15" will leave the
3660
3672
    branch at revision 15.
3661
3673
 
3662
 
    In the future, uncommit will create a revision bundle, which can then
3663
 
    be re-applied.
 
3674
    Uncommit leaves the working tree ready for a new commit.  The only change
 
3675
    it may make is to restore any pending merges that were present before
 
3676
    the commit.
3664
3677
    """
3665
3678
 
3666
3679
    # TODO: jam 20060108 Add an option to allow uncommit to remove