[meld] vc._vc: Refactor state comparisons for PEP8 line length
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] vc._vc: Refactor state comparisons for PEP8 line length
- Date: Sun, 31 Dec 2017 20:16:26 +0000 (UTC)
commit 437fae68a02c25280069338b63fb547090bd1c00
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Dec 23 09:33:22 2017 +1000
vc._vc: Refactor state comparisons for PEP8 line length
meld/vc/_vc.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index e57a2ea3..d80f287e 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -216,6 +216,10 @@ class Vc(object):
# TODO: We can't do this; this shells out for each selection change...
# if bool(self.get_commits_to_push()):
valid_actions.add('push')
+
+ non_removeable_states = (STATE_NONE, STATE_IGNORED, STATE_REMOVED)
+ non_revertable_states = (STATE_NONE, STATE_NORMAL, STATE_IGNORED)
+
# TODO: We can't disable this for NORMAL, because folders don't
# inherit any state from their children, but committing a folder with
# modified children is expected behaviour.
@@ -225,10 +229,10 @@ class Vc(object):
valid_actions.add('add')
if all(s == STATE_CONFLICT for s in states):
valid_actions.add('resolve')
- if (all(s not in (STATE_NONE, STATE_IGNORED, STATE_REMOVED) for s in states)
+ if (all(s not in non_removeable_states for s in states)
and self.root not in path_states.keys()):
valid_actions.add('remove')
- if all(s not in (STATE_NONE, STATE_NORMAL, STATE_IGNORED) for s in states):
+ if all(s not in non_revertable_states for s in states):
valid_actions.add('revert')
return valid_actions
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]