~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-07-13 13:37:54 UTC
  • mfrom: (1850.3.6 uncommit-31426)
  • Revision ID: pqm@pqm.ubuntu.com-20060713133754-64c134fffd39fd99
(jam) update uncommit (bugs: #32526, #31426)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2637
2637
    takes_args = ['location?']
2638
2638
    aliases = []
2639
2639
 
2640
 
    def run(self, location=None, 
 
2640
    def run(self, location=None,
2641
2641
            dry_run=False, verbose=False,
2642
2642
            revision=None, force=False):
2643
 
        from bzrlib.log import log_formatter
 
2643
        from bzrlib.log import log_formatter, show_log
2644
2644
        import sys
2645
2645
        from bzrlib.uncommit import uncommit
2646
2646
 
2654
2654
            tree = None
2655
2655
            b = control.open_branch()
2656
2656
 
 
2657
        rev_id = None
2657
2658
        if revision is None:
2658
2659
            revno = b.revno()
2659
 
            rev_id = b.last_revision()
2660
2660
        else:
2661
 
            revno, rev_id = revision[0].in_history(b)
 
2661
            # 'bzr uncommit -r 10' actually means uncommit
 
2662
            # so that the final tree is at revno 10.
 
2663
            # but bzrlib.uncommit.uncommit() actually uncommits
 
2664
            # the revisions that are supplied.
 
2665
            # So we need to offset it by one
 
2666
            revno = revision[0].in_history(b).revno+1
 
2667
 
 
2668
        if revno <= b.revno():
 
2669
            rev_id = b.get_rev_id(revno)
2662
2670
        if rev_id is None:
2663
 
            print 'No revisions to uncommit.'
2664
 
 
2665
 
        for r in range(revno, b.revno()+1):
2666
 
            rev_id = b.get_rev_id(r)
2667
 
            lf = log_formatter('short', to_file=sys.stdout,show_timezone='original')
2668
 
            lf.show(r, b.repository.get_revision(rev_id), None)
 
2671
            self.outf.write('No revisions to uncommit.\n')
 
2672
            return 1
 
2673
 
 
2674
        lf = log_formatter('short',
 
2675
                           to_file=self.outf,
 
2676
                           show_timezone='original')
 
2677
 
 
2678
        show_log(b,
 
2679
                 lf,
 
2680
                 verbose=False,
 
2681
                 direction='forward',
 
2682
                 start_revision=revno,
 
2683
                 end_revision=b.revno())
2669
2684
 
2670
2685
        if dry_run:
2671
2686
            print 'Dry-run, pretending to remove the above revisions.'