Rev 3166: diff current tree, not directory, by default (Ian Clatworthy, #178591) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jan 4 03:53:02 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3166
revision-id:pqm at pqm.ubuntu.com-20080104035252-47tqschd3kbq66vc
parent: pqm at pqm.ubuntu.com-20080104024907-k4ld11wri0m0tvxq
parent: ian.clatworthy at internode.on.net-20080104015635-ripc56yorn0f4v4a
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-01-04 03:52:52 +0000
message:
  diff current tree, not directory, by default (Ian Clatworthy, #178591)
modified:
  bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
  bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
    ------------------------------------------------------------
    revno: 3164.1.1
    revision-id:ian.clatworthy at internode.on.net-20080104015635-ripc56yorn0f4v4a
    parent: pqm at pqm.ubuntu.com-20080103231814-wymg8td870lqfzkv
    parent: ian.clatworthy at internode.on.net-20080104002605-wusiuhvzkpt8ovcd
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: ianc-integration
    timestamp: Fri 2008-01-04 11:56:35 +1000
    message:
      diff current tree, not directory, by default (Ian Clatworthy, #178591)
    modified:
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
    ------------------------------------------------------------
    revno: 3164.2.1
    revision-id:ian.clatworthy at internode.on.net-20080104002605-wusiuhvzkpt8ovcd
    parent: pqm at pqm.ubuntu.com-20080103231814-wymg8td870lqfzkv
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: bzr.diff-fulltree
    timestamp: Fri 2008-01-04 10:26:05 +1000
    message:
      diff without arguments means the current tree, not the current directory
    modified:
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py	2008-01-03 16:01:06 +0000
+++ b/bzrlib/diff.py	2008-01-04 00:26:05 +0000
@@ -388,9 +388,11 @@
 
     other_paths = []
     make_paths_wt_relative = True
+    consider_relpath = True
     if path_list is None or len(path_list) == 0:
-        # If no path is given, assume the current directory
+        # If no path is given, the current working tree is used
         default_location = u'.'
+        consider_relpath = False
     elif old_url is not None and new_url is not None:
         other_paths = path_list
         make_paths_wt_relative = False
@@ -404,7 +406,7 @@
         old_url = default_location
     working_tree, branch, relpath = \
         bzrdir.BzrDir.open_containing_tree_or_branch(old_url)
-    if relpath != '':
+    if consider_relpath and relpath != '':
         specific_files.append(relpath)
     old_tree = _get_tree_to_diff(old_revision_spec, working_tree, branch)
 
@@ -414,7 +416,7 @@
     if new_url != old_url:
         working_tree, branch, relpath = \
             bzrdir.BzrDir.open_containing_tree_or_branch(new_url)
-        if relpath != '':
+        if consider_relpath and relpath != '':
             specific_files.append(relpath)
     new_tree = _get_tree_to_diff(new_revision_spec, working_tree, branch,
         basis_is_default=working_tree is None)

=== modified file 'bzrlib/tests/blackbox/test_diff.py'
--- a/bzrlib/tests/blackbox/test_diff.py	2007-12-04 06:39:55 +0000
+++ b/bzrlib/tests/blackbox/test_diff.py	2008-01-04 00:26:05 +0000
@@ -259,6 +259,14 @@
         output = self.run_bzr('diff -r 1.. branch1', retcode=1)
         self.assertContainsRe(output[0], '\n\\-original line\n\\+new line\n')
 
+    def test_diff_to_working_tree_in_subdir(self):
+        self.example_branch2()
+        self.build_tree_contents([('branch1/file1', 'new line')])
+        os.mkdir('branch1/dir1')
+        os.chdir('branch1/dir1')
+        output = self.run_bzr('diff -r 1..', retcode=1)
+        self.assertContainsRe(output[0], '\n\\-original line\n\\+new line\n')
+
     def test_diff_across_rename(self):
         """The working tree path should always be considered for diffing"""
         tree = self.make_example_branch()




More information about the bazaar-commits mailing list