~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 12:24:32 UTC
  • mfrom: (1861 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1863.
  • Revision ID: john@arbash-meinel.com-20060713122432-f66fd0000dabb58e
[merge] bzr.dev 1861

Show diffs side-by-side

added added

removed removed

Lines of Context:
375
375
    encoding_type = 'replace'
376
376
 
377
377
    def run(self, names_list):
 
378
        if names_list is None:
 
379
            names_list = []
 
380
 
378
381
        if len(names_list) < 2:
379
382
            raise BzrCommandError("missing file argument")
380
383
        tree, rel_names = tree_files(names_list)
1075
1078
 
1076
1079
 
1077
1080
class cmd_diff(Command):
1078
 
    """Show differences in working tree.
 
1081
    """Show differences in the working tree or between revisions.
1079
1082
    
1080
1083
    If files are listed, only the changes in those files are listed.
1081
1084
    Otherwise, all changes for the tree are listed.
1085
1088
 
1086
1089
    examples:
1087
1090
        bzr diff
 
1091
            Shows the difference in the working tree versus the last commit
1088
1092
        bzr diff -r1
 
1093
            Difference between the working tree and revision 1
1089
1094
        bzr diff -r1..2
 
1095
            Difference between revision 2 and revision 1
1090
1096
        bzr diff --diff-prefix old/:new/
 
1097
            Same as 'bzr diff' but prefix paths with old/ and new/
1091
1098
        bzr diff bzr.mine bzr.dev
 
1099
            Show the differences between the two working trees
1092
1100
        bzr diff foo.c
 
1101
            Show just the differences for 'foo.c'
1093
1102
    """
1094
1103
    # TODO: Option to use external diff command; could be GNU diff, wdiff,
1095
1104
    #       or a graphical diff.
1139
1148
                # FIXME diff those two files. rbc 20051123
1140
1149
                raise BzrCommandError("Files are in different branches")
1141
1150
            file_list = None
 
1151
        except NotBranchError:
 
1152
            # Don't raise an error when bzr diff is called from
 
1153
            # outside a working tree.
 
1154
            tree1, tree2 = None, None
1142
1155
        if revision is not None:
1143
1156
            if tree2 is not None:
1144
1157
                raise BzrCommandError("Can't specify -r with two branches")
1817
1830
                self.outf.write(c.username() + '\n')
1818
1831
            return
1819
1832
 
 
1833
        # display a warning if an email address isn't included in the given name.
 
1834
        try:
 
1835
            config.extract_email_address(name)
 
1836
        except BzrError, e:
 
1837
            warning('"%s" does not seem to contain an email address.  '
 
1838
                    'This is allowed, but not recommended.', name)
 
1839
        
1820
1840
        # use global config unless --branch given
1821
1841
        if branch:
1822
1842
            c = Branch.open_containing('.')[0].get_config()