[meld/VersionControlRework: 26/28] Merge branch 'master' into VersionControlRework



commit 557b41d0a33a6da9a2bb75e383f2e616e8eab3aa
Merge: 1c654d5 388f2a8
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jun 28 10:00:20 2015 +1000

    Merge branch 'master' into VersionControlRework

 NEWS                       |   62 +
 help/C/file-filters.page   |    2 +-
 help/C/flattened-view.page |    2 +-
 help/C/text-filters.page   |    2 +-
 help/cs/cs.po              |   12 +-
 maint.py                   |    9 +-
 meld.1                     |   32 +-
 meld/conf.py               |    2 +-
 meld/dirdiff.py            |    3 +
 meld/filediff.py           |    3 +
 meld/meldapp.py            |   14 +-
 meld/meldbuffer.py         |   12 +-
 meld/misc.py               |   25 +
 meld/newdifftab.py         |    7 +-
 meld/recent.py             |    2 +-
 meld/vc/git.py             |    3 -
 meld/vcview.py             |   38 +-
 po/hu.po                   | 1018 ++++++++-----
 po/pt.po                   | 3724 +++++++++++++++++++++++++++++---------------
 test/test_matchers.py      |   28 +-
 20 files changed, 3285 insertions(+), 1715 deletions(-)
---
diff --cc meld/vc/git.py
index ee059df,23bc5cd..4f4329c
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@@ -64,8 -66,11 +64,6 @@@ class Vc(_vc.Vc)
          "U": _vc.STATE_CONFLICT,  # Unmerged
      }
  
-     file_encoding = sys.getfilesystemencoding()
- 
 -    def __init__(self, location):
 -        super(Vc, self).__init__(location)
 -        self._tree_cache = {}
 -        self._tree_meta_cache = {}
 -
      @classmethod
      def is_installed(cls):
          try:
diff --cc meld/vcview.py
index 4e9a5f1,15cf795..7ef36fa
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@@ -144,12 -176,19 +144,19 @@@ class VcView(melddoc.MeldDoc, gnomeglad
  
      state_actions = {
          "flatten": ("VcFlatten", None),
 -        "modified": ("VcShowModified", entry_modified),
 -        "normal": ("VcShowNormal", entry_normal),
 -        "unknown": ("VcShowNonVC", entry_nonvc),
 -        "ignored": ("VcShowIgnored", entry_ignored),
 +        "modified": ("VcShowModified", Entry.is_modified),
 +        "normal": ("VcShowNormal", Entry.is_normal),
 +        "unknown": ("VcShowNonVC", Entry.is_nonvc),
 +        "ignored": ("VcShowIgnored", Entry.is_ignored),
      }
  
+     file_encoding = sys.getfilesystemencoding()
+ 
+     @classmethod
+     def display_path(cls, bytes):
+         encodings = (cls.file_encoding,)
+         return misc.fallback_decode(bytes, encodings, lossy=True)
+ 
      def __init__(self):
          melddoc.MeldDoc.__init__(self)
          gnomeglade.Component.__init__(self, "vcview.ui", "vcview",
@@@ -319,12 -420,9 +326,9 @@@
          return recent.TYPE_VC, [self.location]
  
      def recompute_label(self):
-         location = self.location
-         if isinstance(location, str):
-             location = location.decode(
-                 sys.getfilesystemencoding(), 'replace')
+         location = self.display_path(self.location)
          self.label_text = os.path.basename(location)
 -        # TRANSLATORS: This is the location of the directory the user is diffing
 +        # TRANSLATORS: This is the location of the directory being viewed
          self.tooltip_text = _("%s: %s") % (_("Location"), location)
          self.label_changed()
  
@@@ -334,24 -433,24 +339,23 @@@
          symlinks_followed = set()
          todo = [(self.model.get_path(iterstart), rootname)]
  
 -        flattened = self.actiongroup.get_action("VcFlatten").get_active()
 -        active_action = lambda a: self.actiongroup.get_action(a).get_active()
 -        filters = [a[1] for a in self.state_actions.values() if
 -                   active_action(a[0]) and a[1]]
 +        flattened = 'flatten' in self.props.status_filters
 +        active_actions = [
 +            self.state_actions.get(k) for k in self.props.status_filters]
 +        filters = [a[1] for a in active_actions if a and a[1]]
  
-         yield _("Scanning %s") % rootname
 -        self.vc.cache_inventory(rootname)
          while todo:
              # This needs to happen sorted and depth-first in order for our row
              # references to remain valid while we traverse.
              todo.sort()
              treepath, path = todo.pop(0)
              it = self.model.get_iter(treepath)
-             yield _("Scanning %s") % path[prefixlen:]
+             yield _("Scanning %s") % self.display_path(path)[display_prefix:]
  
 -            entries = self.vc.listdir(path)
 +            entries = self.vc.get_entries(path)
              entries = [e for e in entries if any(f(e) for f in filters)]
              for e in entries:
 -                if e.isdir and e.state != tree.STATE_REMOVED:
 +                if e.isdir and e.is_present():
                      try:
                          st = os.lstat(e.path)
                      # Covers certain unreadable symlink cases; see bgo#585895
@@@ -417,7 -517,8 +421,7 @@@
              self.emit("create-diff", [path], {})
              return
  
-         basename = os.path.basename(path)
 -        left_is_local = self.props.left_is_local
+         basename = self.display_path(os.path.basename(path))
          meta = {
              'parent': self,
              'prompt_resolve': False,
@@@ -518,24 -617,32 +522,24 @@@
          if selection is None:
              selection = self.treeview.get_selection()
          model, rows = selection.get_selected_rows()
-         paths = [self.model.value_path(model.get_iter(r), 0) for r in rows]
 -        if hasattr(self.vc, 'update_actions_for_paths'):
 -            paths = [self.model.get_file_path(model.get_iter(r)) for r in rows]
 -            states = [self.model.get_state(model.get_iter(r), 0) for r in rows]
 -            action_sensitivity = {
 -                "VcCompare": False,
 -                "VcCommit": False,
 -                "VcUpdate": False,
 -                "VcPush": False,
 -                "VcAdd": False,
 -                "VcResolved": False,
 -                "VcRemove": False,
 -                "VcRevert": False,
 -                "VcDeleteLocally": bool(paths) and self.vc.root not in paths,
 -            }
 -            path_states = dict(zip(paths, states))
 -            self.vc.update_actions_for_paths(path_states, action_sensitivity)
 -            for action, sensitivity in action_sensitivity.items():
 -                set_sensitive(action, sensitivity)
 -        else:
 -            have_selection = bool(rows)
 -            for action in self.valid_vc_actions:
 -                set_sensitive(action, have_selection)
++        paths = [self.model.get_file_path(model.get_iter(r)) for r in rows]
 +        states = [self.model.get_state(model.get_iter(r), 0) for r in rows]
 +        path_states = dict(zip(paths, states))
 +
 +        valid_actions = self.vc.get_valid_actions(path_states)
 +        action_sensitivity = {
 +            "VcCompare": 'compare' in valid_actions,
 +            "VcCommit": 'commit' in valid_actions,
 +            "VcUpdate": 'update' in valid_actions,
 +            "VcPush": 'push' in valid_actions,
 +            "VcAdd": 'add' in valid_actions,
 +            "VcResolved": 'resolve' in valid_actions,
 +            "VcRemove": 'remove' in valid_actions,
 +            "VcRevert": 'revert' in valid_actions,
 +            "VcDeleteLocally": bool(paths) and self.vc.root not in paths,
 +        }
 +        for action, sensitivity in action_sensitivity.items():
 +            self.actiongroup.get_action(action).set_sensitive(sensitivity)
  
      def _get_selected_files(self):
          model, rows = self.treeview.get_selection().get_selected_rows()
@@@ -670,10 -802,7 +674,10 @@@
          self._open_files(self._get_selected_files())
  
      def refresh(self):
 -        self.set_location(self.model.get_file_path(self.model.get_iter_first()))
 +        root = self.model.get_iter_first()
 +        if root is None:
 +            return
-         self.set_location(self.model.value_path(root, 0))
++        self.set_location(self.model.get_file_path(root))
  
      def refresh_partial(self, where):
          if not self.actiongroup.get_action("VcFlatten").get_active():
@@@ -707,10 -836,15 +711,10 @@@
      def on_file_changed(self, filename):
          it = self.find_iter_by_name(filename)
          if it:
-             path = self.model.value_path(it, 0)
+             path = self.model.get_file_path(it)
 -            self.vc.update_file_state(path)
 -            files = self.vc.lookup_files([], [(os.path.basename(path), path)])[1]
 -            for e in files:
 -                if e.path == path:
 -                    prefixlen = 1 + len(
 -                        self.model.get_file_path(self.model.get_iter_first()))
 -                    self._update_item_state( it, e, e.parent[prefixlen:])
 -                    return
 +            self.vc.refresh_vc_state(path)
 +            entry = self.vc.get_entry(path)
 +            self._update_item_state(it, entry)
  
      def find_iter_by_name(self, name):
          it = self.model.get_iter_first()
@@@ -719,9 -853,9 +723,9 @@@
              if name == path:
                  return it
              elif name.startswith(path):
 -                child = self.model.iter_children( it )
 +                child = self.model.iter_children(it)
                  while child:
-                     path = self.model.value_path(child, 0)
+                     path = self.model.get_file_path(child)
                      if name == path:
                          return child
                      elif name.startswith(path):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]