~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2010-03-01 16:18:43 UTC
  • mfrom: (4988.8.4 giveback)
  • mto: This revision was merged to the branch mainline in revision 5066.
  • Revision ID: v.ladeuil+lp@free.fr-20100301161843-sxbpwzvcxlzk8zah
More builtin command UIFactory updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
2684
2684
        if old_default_rules is not None:
2685
2685
            # dump the rules and exit
2686
2686
            for pattern in ignores.OLD_DEFAULTS:
2687
 
                print pattern
 
2687
                self.outf.write("%s\n" % pattern)
2688
2688
            return
2689
2689
        if not name_pattern_list:
2690
2690
            raise errors.BzrCommandError("ignore requires at least one "
2706
2706
            if id is not None:
2707
2707
                filename = entry[0]
2708
2708
                if ignored.match(filename):
2709
 
                    matches.append(filename.encode('utf-8'))
 
2709
                    matches.append(filename)
2710
2710
        tree.unlock()
2711
2711
        if len(matches) > 0:
2712
 
            print "Warning: the following files are version controlled and" \
2713
 
                  " match your ignore pattern:\n%s" \
2714
 
                  "\nThese files will continue to be version controlled" \
2715
 
                  " unless you 'bzr remove' them." % ("\n".join(matches),)
 
2712
            self.outf.write("Warning: the following files are version controlled and"
 
2713
                  " match your ignore pattern:\n%s"
 
2714
                  "\nThese files will continue to be version controlled"
 
2715
                  " unless you 'bzr remove' them.\n" % ("\n".join(matches),))
2716
2716
 
2717
2717
 
2718
2718
class cmd_ignored(Command):
2756
2756
        try:
2757
2757
            revno = int(revno)
2758
2758
        except ValueError:
2759
 
            raise errors.BzrCommandError("not a valid revision-number: %r" % revno)
2760
 
 
2761
 
        print WorkingTree.open_containing(u'.')[0].branch.get_rev_id(revno)
 
2759
            raise errors.BzrCommandError("not a valid revision-number: %r"
 
2760
                                         % revno)
 
2761
        revid = WorkingTree.open_containing(u'.')[0].branch.get_rev_id(revno)
 
2762
        self.outf.write("%s\n" % revid)
2762
2763
 
2763
2764
 
2764
2765
class cmd_export(Command):
2911
2912
    hidden = True
2912
2913
    @display_command
2913
2914
    def run(self):
2914
 
        print osutils.local_time_offset()
 
2915
        self.outf.write("%s\n" % osutils.local_time_offset())
2915
2916
 
2916
2917
 
2917
2918
 
3339
3340
 
3340
3341
    @display_command
3341
3342
    def printme(self, branch):
3342
 
        print branch.nick
 
3343
        self.outf.write('%s\n' % branch.nick)
3343
3344
 
3344
3345
 
3345
3346
class cmd_alias(Command):
3619
3620
 
3620
3621
    @display_command
3621
3622
    def run(self):
3622
 
        print "It sure does!"
 
3623
        self.outf.write("It sure does!\n")
3623
3624
 
3624
3625
 
3625
3626
class cmd_find_merge_base(Command):
3645
3646
        graph = branch1.repository.get_graph(branch2.repository)
3646
3647
        base_rev_id = graph.find_unique_lca(last1, last2)
3647
3648
 
3648
 
        print 'merge base is revision %s' % base_rev_id
 
3649
        self.outf.write('merge base is revision %s\n' % base_rev_id)
3649
3650
 
3650
3651
 
3651
3652
class cmd_merge(Command):
4444
4445
                doc = '(no description)'
4445
4446
            result.append((name_ver, doc, plugin.path()))
4446
4447
        for name_ver, doc, path in sorted(result):
4447
 
            print name_ver
4448
 
            print '   ', doc
 
4448
            self.outf.write("%s\n" % name_ver)
 
4449
            self.outf.write("   %s\n" % doc)
4449
4450
            if verbose:
4450
 
                print '   ', path
4451
 
            print
 
4451
                self.outf.write("   %s\n" % path)
 
4452
            self.outf.write("\n")
4452
4453
 
4453
4454
 
4454
4455
class cmd_testament(Command):
4734
4735
                rev_id = b.get_rev_id(revno)
4735
4736
 
4736
4737
        if rev_id is None or _mod_revision.is_null(rev_id):
4737
 
            ui.ui_factory.note('No revisions to uncommit.')
 
4738
            self.outf.write('No revisions to uncommit.\n')
4738
4739
            return 1
4739
4740
 
4740
 
        log_collector = ui.ui_factory.make_output_stream()
4741
4741
        lf = log_formatter('short',
4742
 
                           to_file=log_collector,
 
4742
                           to_file=self.outf,
4743
4743
                           show_timezone='original')
4744
4744
 
4745
4745
        show_log(b,
4750
4750
                 end_revision=last_revno)
4751
4751
 
4752
4752
        if dry_run:
4753
 
            ui.ui_factory.note('Dry-run, pretending to remove the above revisions.')
 
4753
            self.outf.write('Dry-run, pretending to remove'
 
4754
                            ' the above revisions.\n')
4754
4755
        else:
4755
 
            ui.ui_factory.note('The above revision(s) will be removed.')
 
4756
            self.outf.write('The above revision(s) will be removed.\n')
4756
4757
 
4757
4758
        if not force:
4758
 
            if not ui.ui_factory.get_boolean('Are you sure [y/N]? '):
4759
 
                ui.ui_factory.note('Canceled')
 
4759
            if not ui.ui_factory.get_boolean('Are you sure'):
 
4760
                self.outf.write('Canceled')
4760
4761
                return 0
4761
4762
 
4762
4763
        mutter('Uncommitting from {%s} to {%s}',
4763
4764
               last_rev_id, rev_id)
4764
4765
        uncommit(b, tree=tree, dry_run=dry_run, verbose=verbose,
4765
4766
                 revno=revno, local=local)
4766
 
        ui.ui_factory.note('You can restore the old tip by running:\n'
4767
 
             '  bzr pull . -r revid:%s' % last_rev_id)
 
4767
        self.outf.write('You can restore the old tip by running:\n'
 
4768
             '  bzr pull . -r revid:%s\n' % last_rev_id)
4768
4769
 
4769
4770
 
4770
4771
class cmd_break_lock(Command):