running 'bzr status' on an unknown file falls back to default 'bzr status'

Bug #53638 reported by Szilveszter Farkas
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
John A Meinel

Bug Description

Steps to reproduce:
---
phanatic@methexis:~/temp/testinit$ bzr init
phanatic@methexis:~/temp/testinit$ touch a.py
phanatic@methexis:~/temp/testinit$ touch b.py
phanatic@methexis:~/temp/testinit$ bzr add a.py
added a.py
phanatic@methexis:~/temp/testinit$ bzr status a.py
added:
  a.py
phanatic@methexis:~/temp/testinit$ bzr status b.py
added:
  a.py
unknown:
  b.py
phanatic@methexis:~/temp/testinit$ bzr status
added:
  a.py
unknown:
  b.py
---
I think that 'bzr status <unknown_file>' shouldn't fallback to the default behaviour of 'bzr status'. Instead, it should just print 'unknown: <unknown_file>'

description: updated
Revision history for this message
John A Meinel (jameinel) wrote :

The specific implementation issue is that compare_trees filters the trees by 'file_id', not by path. So compare_trees itself does not operate on unknown files. (It uses the file id to match between the trees anyway).

Now 'show_tree_status' is a higher level wrapper around compare_trees, which then goes through unknowns after it processed compare_trees.

So the specific bug is that passing in a specific_file_list may result in an empty specific_file_ids list, which then results in a complete delta.

This patch should fix that specific bug, so that if a list is sent that only contains unknown files, compare_trees just returns an empty delta.

=== modified file 'bzrlib/delta.py'
--- bzrlib/delta.py 2006-07-06 13:51:22 +0000
+++ bzrlib/delta.py 2006-07-21 13:31:40 +0000
@@ -184,6 +184,9 @@
                 trees = trees + tuple(extra_trees)
             specific_file_ids = tree.find_ids_across_trees(specific_files,
                 trees, require_versioned=require_versioned)
+ if specific_files and not specific_file_ids:
+ # All the requested files are unknowns
+ return TreeDelta()
             return _compare_trees(old_tree, new_tree, want_unchanged,
                                   specific_file_ids)
         finally:

Revision history for this message
Szilveszter Farkas (phanatic) wrote :

Thanks for your patch, it works as expected:
---
phanatic@methexis:~/temp/testinit$ bzr status b.py
unknown:
  b.py
---
It would be really cool to have it in 0.9, but I don't know how to create a test for this :(

Revision history for this message
John A Meinel (jameinel) wrote :

This should be fixed in the attached branch.

Changed in bzr:
assignee: nobody → jameinel
importance: Untriaged → Medium
status: Unconfirmed → Fix Committed
John A Meinel (jameinel)
Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.