/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: Andrew Bennetts
  • Date: 2008-03-12 20:13:07 UTC
  • mfrom: (3267 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3756.
  • Revision ID: andrew.bennetts@canonical.com-20080312201307-ngd5bynt2nvhnlb7
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
534
534
        if len(names_list) < 2:
535
535
            raise errors.BzrCommandError("missing file argument")
536
536
        tree, rel_names = tree_files(names_list)
537
 
        
538
 
        if os.path.isdir(names_list[-1]):
 
537
 
 
538
        dest = names_list[-1]
 
539
        isdir = os.path.isdir(dest)
 
540
        if (isdir and not tree.case_sensitive and len(rel_names) == 2
 
541
            and rel_names[0].lower() == rel_names[1].lower()):
 
542
                isdir = False
 
543
        if isdir:
539
544
            # move into existing directory
540
545
            for pair in tree.move(rel_names[:-1], rel_names[-1], after=after):
541
546
                self.outf.write("%s => %s\n" % pair)
546
551
                                             ' directory')
547
552
            tree.rename_one(rel_names[0], rel_names[1], after=after)
548
553
            self.outf.write("%s => %s\n" % (rel_names[0], rel_names[1]))
549
 
            
550
 
    
 
554
 
 
555
 
551
556
class cmd_pull(Command):
552
557
    """Turn this branch into a mirror of another branch.
553
558
 
864
869
 
865
870
    _see_also = ['checkout']
866
871
    takes_args = ['from_location', 'to_location?']
867
 
    takes_options = ['revision']
 
872
    takes_options = ['revision', Option('hardlink',
 
873
        help='Hard-link working tree files where possible.')]
868
874
    aliases = ['get', 'clone']
869
875
 
870
 
    def run(self, from_location, to_location=None, revision=None):
 
876
    def run(self, from_location, to_location=None, revision=None,
 
877
            hardlink=False):
871
878
        from bzrlib.tag import _merge_tags_if_possible
872
879
        if revision is None:
873
880
            revision = [None]
905
912
                # preserve whatever source format we have.
906
913
                dir = br_from.bzrdir.sprout(to_transport.base, revision_id,
907
914
                                            possible_transports=[to_transport],
908
 
                                            accelerator_tree=accelerator_tree)
 
915
                                            accelerator_tree=accelerator_tree,
 
916
                                            hardlink=hardlink)
909
917
                branch = dir.open_branch()
910
918
            except errors.NoSuchRevision:
911
919
                to_transport.delete_tree('.')
950
958
                                 "common operations like diff and status without "
951
959
                                 "such access, and also support local commits."
952
960
                            ),
953
 
                     Option('files-from',
954
 
                            help="Get file contents from this tree.", type=str)
 
961
                     Option('files-from', type=str,
 
962
                            help="Get file contents from this tree."),
 
963
                     Option('hardlink',
 
964
                            help='Hard-link working tree files where possible.'
 
965
                            ),
955
966
                     ]
956
967
    aliases = ['co']
957
968
 
958
969
    def run(self, branch_location=None, to_location=None, revision=None,
959
 
            lightweight=False, files_from=None):
 
970
            lightweight=False, files_from=None, hardlink=False):
960
971
        if revision is None:
961
972
            revision = [None]
962
973
        elif len(revision) > 1:
987
998
                source.bzrdir.create_workingtree(revision_id)
988
999
                return
989
1000
        source.create_checkout(to_location, revision_id, lightweight,
990
 
                               accelerator_tree)
 
1001
                               accelerator_tree, hardlink)
991
1002
 
992
1003
 
993
1004
class cmd_renames(Command):
1929
1940
        Ignore .o files under the lib directory::
1930
1941
 
1931
1942
            bzr ignore "RE:lib/.*\.o"
 
1943
 
 
1944
        Ignore everything but the "debian" toplevel directory::
 
1945
 
 
1946
            bzr ignore "RE:(?!debian/).*"
1932
1947
    """
1933
1948
 
1934
1949
    _see_also = ['status', 'ignored']
2398
2413
                try:
2399
2414
                    repo_basis = tree.branch.repository.revision_tree(
2400
2415
                        tree.last_revision())
2401
 
                    if len(list(repo_basis._iter_changes(tree_basis))):
 
2416
                    if len(list(repo_basis.iter_changes(tree_basis))):
2402
2417
                        raise errors.BzrCheckError(
2403
2418
                            "Mismatched basis inventory content.")
2404
2419
                    tree._validate()
2657
2672
            if benchfile is not None:
2658
2673
                benchfile.close()
2659
2674
        if result:
2660
 
            info('tests passed')
 
2675
            note('tests passed')
2661
2676
        else:
2662
 
            info('tests failed')
 
2677
            note('tests failed')
2663
2678
        return int(not result)
2664
2679
 
2665
2680
 
2997
3012
        mutter("%s", stored_location)
2998
3013
        if stored_location is None:
2999
3014
            raise errors.BzrCommandError("No location specified or remembered")
3000
 
        display_url = urlutils.unescape_for_display(stored_location,
3001
 
            self.outf.encoding)
3002
 
        self.outf.write("%s remembered location %s\n" % (verb_string,
3003
 
            display_url))
 
3015
        display_url = urlutils.unescape_for_display(stored_location, 'utf-8')
 
3016
        note(u"%s remembered location %s", verb_string, display_url)
3004
3017
        return stored_location
3005
3018
 
3006
3019
 
4156
4169
                else:
4157
4170
                    revision = branch.repository.get_revision(revision_id)
4158
4171
                    subject += revision.get_summary()
 
4172
                basename = directive.get_disk_name(branch)
4159
4173
                mail_client.compose_merge_request(mail_to, subject,
4160
 
                                                  outfile.getvalue())
 
4174
                                                  outfile.getvalue(), basename)
4161
4175
        finally:
4162
4176
            if output != '-':
4163
4177
                outfile.close()