/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Parth Malwankar
  • Date: 2010-03-06 01:26:10 UTC
  • mfrom: (5076 +trunk)
  • mto: (5094.3.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5107.
  • Revision ID: parth.malwankar@gmail.com-20100306012610-a32cmtc938t6vw8p
merged trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
699
699
 
700
700
    def run(self, dir_list):
701
701
        for d in dir_list:
702
 
            os.mkdir(d)
703
702
            wt, dd = WorkingTree.open_containing(d)
704
 
            wt.add([dd])
705
 
            self.outf.write('added %s\n' % d)
 
703
            base = os.path.dirname(dd)
 
704
            id = wt.path2id(base)
 
705
            if id != None:
 
706
                os.mkdir(d)
 
707
                wt.add([dd])
 
708
                self.outf.write('added %s\n' % d)
 
709
            else:
 
710
                raise errors.NotVersionedError(path=base)
706
711
 
707
712
 
708
713
class cmd_relpath(Command):
2684
2689
        if old_default_rules is not None:
2685
2690
            # dump the rules and exit
2686
2691
            for pattern in ignores.OLD_DEFAULTS:
2687
 
                print pattern
 
2692
                self.outf.write("%s\n" % pattern)
2688
2693
            return
2689
2694
        if not name_pattern_list:
2690
2695
            raise errors.BzrCommandError("ignore requires at least one "
2706
2711
            if id is not None:
2707
2712
                filename = entry[0]
2708
2713
                if ignored.match(filename):
2709
 
                    matches.append(filename.encode('utf-8'))
 
2714
                    matches.append(filename)
2710
2715
        tree.unlock()
2711
2716
        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),)
 
2717
            self.outf.write("Warning: the following files are version controlled and"
 
2718
                  " match your ignore pattern:\n%s"
 
2719
                  "\nThese files will continue to be version controlled"
 
2720
                  " unless you 'bzr remove' them.\n" % ("\n".join(matches),))
2716
2721
 
2717
2722
 
2718
2723
class cmd_ignored(Command):
2756
2761
        try:
2757
2762
            revno = int(revno)
2758
2763
        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)
 
2764
            raise errors.BzrCommandError("not a valid revision-number: %r"
 
2765
                                         % revno)
 
2766
        revid = WorkingTree.open_containing(u'.')[0].branch.get_rev_id(revno)
 
2767
        self.outf.write("%s\n" % revid)
2762
2768
 
2763
2769
 
2764
2770
class cmd_export(Command):
2911
2917
    hidden = True
2912
2918
    @display_command
2913
2919
    def run(self):
2914
 
        print osutils.local_time_offset()
 
2920
        self.outf.write("%s\n" % osutils.local_time_offset())
2915
2921
 
2916
2922
 
2917
2923
 
3168
3174
            raise errors.BzrCommandError("Commit refused because there are"
3169
3175
                              " unknown files in the working tree.")
3170
3176
        except errors.BoundBranchOutOfDate, e:
3171
 
            raise errors.BzrCommandError(str(e) + "\n"
3172
 
            'To commit to master branch, run update and then commit.\n'
3173
 
            'You can also pass --local to commit to continue working '
3174
 
            'disconnected.')
 
3177
            e.extra_help = ("\n"
 
3178
                'To commit to master branch, run update and then commit.\n'
 
3179
                'You can also pass --local to commit to continue working '
 
3180
                'disconnected.')
 
3181
            raise
3175
3182
 
3176
3183
 
3177
3184
class cmd_check(Command):
3339
3346
 
3340
3347
    @display_command
3341
3348
    def printme(self, branch):
3342
 
        print branch.nick
 
3349
        self.outf.write('%s\n' % branch.nick)
3343
3350
 
3344
3351
 
3345
3352
class cmd_alias(Command):
3619
3626
 
3620
3627
    @display_command
3621
3628
    def run(self):
3622
 
        print "It sure does!"
 
3629
        self.outf.write("It sure does!\n")
3623
3630
 
3624
3631
 
3625
3632
class cmd_find_merge_base(Command):
3645
3652
        graph = branch1.repository.get_graph(branch2.repository)
3646
3653
        base_rev_id = graph.find_unique_lca(last1, last2)
3647
3654
 
3648
 
        print 'merge base is revision %s' % base_rev_id
 
3655
        self.outf.write('merge base is revision %s\n' % base_rev_id)
3649
3656
 
3650
3657
 
3651
3658
class cmd_merge(Command):
4444
4451
                doc = '(no description)'
4445
4452
            result.append((name_ver, doc, plugin.path()))
4446
4453
        for name_ver, doc, path in sorted(result):
4447
 
            print name_ver
4448
 
            print '   ', doc
 
4454
            self.outf.write("%s\n" % name_ver)
 
4455
            self.outf.write("   %s\n" % doc)
4449
4456
            if verbose:
4450
 
                print '   ', path
4451
 
            print
 
4457
                self.outf.write("   %s\n" % path)
 
4458
            self.outf.write("\n")
4452
4459
 
4453
4460
 
4454
4461
class cmd_testament(Command):
4734
4741
                rev_id = b.get_rev_id(revno)
4735
4742
 
4736
4743
        if rev_id is None or _mod_revision.is_null(rev_id):
4737
 
            ui.ui_factory.note('No revisions to uncommit.')
 
4744
            self.outf.write('No revisions to uncommit.\n')
4738
4745
            return 1
4739
4746
 
4740
 
        log_collector = ui.ui_factory.make_output_stream()
4741
4747
        lf = log_formatter('short',
4742
 
                           to_file=log_collector,
 
4748
                           to_file=self.outf,
4743
4749
                           show_timezone='original')
4744
4750
 
4745
4751
        show_log(b,
4750
4756
                 end_revision=last_revno)
4751
4757
 
4752
4758
        if dry_run:
4753
 
            ui.ui_factory.note('Dry-run, pretending to remove the above revisions.')
 
4759
            self.outf.write('Dry-run, pretending to remove'
 
4760
                            ' the above revisions.\n')
4754
4761
        else:
4755
 
            ui.ui_factory.note('The above revision(s) will be removed.')
 
4762
            self.outf.write('The above revision(s) will be removed.\n')
4756
4763
 
4757
4764
        if not force:
4758
 
            if not ui.ui_factory.get_boolean('Are you sure [y/N]? '):
4759
 
                ui.ui_factory.note('Canceled')
 
4765
            if not ui.ui_factory.get_boolean('Are you sure'):
 
4766
                self.outf.write('Canceled')
4760
4767
                return 0
4761
4768
 
4762
4769
        mutter('Uncommitting from {%s} to {%s}',
4763
4770
               last_rev_id, rev_id)
4764
4771
        uncommit(b, tree=tree, dry_run=dry_run, verbose=verbose,
4765
4772
                 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)
 
4773
        self.outf.write('You can restore the old tip by running:\n'
 
4774
             '  bzr pull . -r revid:%s\n' % last_rev_id)
4768
4775
 
4769
4776
 
4770
4777
class cmd_break_lock(Command):