[with patch] bzr status doesn't give the file type for renamed files.

Bug #4001 reported by Matthieu Moy
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Unassigned

Bug Description

bzr status appends a "@" or a "/" to filenames for directories and symlinks. It doesn't do that for renamed items, which is not consistant.

The patch below is an attempt to solve this.

=== modified file 'bzrlib/delta.py'
--- bzrlib/delta.py
+++ bzrlib/delta.py
@@ -120,10 +120,19 @@
                  text_modified, meta_modified) in self.renamed:
                 if meta_modified:
                     newpath += '*'
+ if kind == 'directory':
+ kind_str = '/'
+ elif kind == 'symlink':
+ kind_str = '@'
+ else:
+ kind_str = '/'
+
                 if show_ids:
- print >>to_file, ' %s => %s %s' % (oldpath, newpath, fid)
+ print >>to_file, ' %s%s => %s%s %s' % \
+ (oldpath, kind_str, newpath, kind_str, fid)
                 else:
- print >>to_file, ' %s => %s' % (oldpath, newpath)
+ print >>to_file, ' %s%s => %s%s' % \
+ (oldpath, kind_str, newpath, kind_str)

         if self.modified:
             print >>to_file, 'modified:'

Revision history for this message
Matthieu Moy (matthieu-moy) wrote :

OOps, small bug in my patch itself. The last assignment on kind_str should be "kind_str = ''".

Below is the updated patch:

=== modified file 'bzrlib/delta.py'
--- bzrlib/delta.py
+++ bzrlib/delta.py
@@ -120,10 +120,19 @@
                  text_modified, meta_modified) in self.renamed:
                 if meta_modified:
                     newpath += '*'
+ if kind == 'directory':
+ kind_str = '/'
+ elif kind == 'symlink':
+ kind_str = '@'
+ else:
+ kind_str = ''
+
                 if show_ids:
- print >>to_file, ' %s => %s %s' % (oldpath, newpath, fid)
+ print >>to_file, ' %s%s => %s%s %s' % \
+ (oldpath, kind_str, newpath, kind_str, fid)
                 else:
- print >>to_file, ' %s => %s' % (oldpath, newpath)
+ print >>to_file, ' %s%s => %s%s' % \
+ (oldpath, kind_str, newpath, kind_str)

         if self.modified:
             print >>to_file, 'modified:'

Revision history for this message
Robert Collins (lifeless) wrote :

You might find entry.kind_character() useful.

Revision history for this message
Matthieu Moy (matthieu-moy) wrote :

Probably. I've just done the same as what was already done for show_list(files) above in the same file. Then both should use entry.kind_character().

I think the kind_character() for a symlink is '', whereas show_list(files) uses '@' (my patch too). That's inconsistant.

Revision history for this message
Robert Collins (lifeless) wrote :

I'd much rather we reduce inconsistency rather than add another manual-if block which can then get out of sync with other code.

Changed in bzr:
status: Unconfirmed → Confirmed
Revision history for this message
Martin Pool (mbp) wrote :

See also bug #40507,

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

The current bzr.dev status code never shows kind characters.
The only code path that displays kind characters is 'bzr ls' when in verbose mode.
Because it is consistent, I'm closing this bug. If we want to bring them back, we should probably open a new bug.

Changed in bzr:
status: Confirmed → 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.