~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: C Miller
  • Date: 2008-03-13 23:22:12 UTC
  • mto: (3299.1.1 bzr.ab.integration)
  • mto: This revision was merged to the branch mainline in revision 3300.
  • Revision ID: bzrdev@chad.org-20080313232212-gl2nml7k11m6623u
Describe the property changes in diffs.  Currently, this is the executable-bit
only.  

Now, includes tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
from bzrlib.symbol_versioning import (
42
42
        deprecated_function,
43
43
        one_zero,
 
44
        one_three
44
45
        )
45
46
from bzrlib.trace import mutter, warning
46
47
 
540
541
        raise errors.PathsDoNotExist(sorted(s))
541
542
 
542
543
 
 
544
@deprecated_function(one_three)
543
545
def get_prop_change(meta_modified):
544
546
    if meta_modified:
545
547
        return " (properties changed)"
546
548
    else:
547
549
        return  ""
548
550
 
 
551
def get_executable_change(old_is_x, new_is_x):
 
552
    descr = { True:"+x", False:"-x", None:"??" }
 
553
    if old_is_x != new_is_x:
 
554
        return ["%s to %s" % (descr[old_is_x], descr[new_is_x],)]
 
555
    else:
 
556
        return []
 
557
 
549
558
 
550
559
class DiffPath(object):
551
560
    """Base type for command object that compare files"""
954
963
            old_present = (kind[0] is not None and versioned[0])
955
964
            new_present = (kind[1] is not None and versioned[1])
956
965
            renamed = (parent[0], name[0]) != (parent[1], name[1])
957
 
            prop_str = get_prop_change(executable[0] != executable[1])
 
966
 
 
967
            properties_changed = []
 
968
            properties_changed.extend(get_executable_change(executable[0], executable[1]))
 
969
 
 
970
            if properties_changed:
 
971
                prop_str = " (properties changed: %s)" % (", ".join(properties_changed),)
 
972
            else:
 
973
                prop_str = ""
 
974
 
958
975
            if (old_present, new_present) == (True, False):
959
976
                self.to_file.write("=== removed %s '%s'\n" %
960
977
                                   (kind[0], oldpath_encoded))