Thread (7 messages) flat view 7 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH 2/6] Move identification of parent branch's remote def up into stack class.

From: Yann Dirson <hidden>
Date: 2016-06-15 22:42:51
Subsystem: the rest · Maintainer: Linus Torvalds

Also adds the __set_parent_remote() counterpart method, but only
private since it is expected to be called only through set_parent, to
be introduced in subsequent patch.

Signed-off-by: Yann Dirson <redacted>
---

 stgit/commands/pull.py |    4 +---
 stgit/stack.py         |   10 ++++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 15ed636..0608fb6 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -53,9 +53,7 @@ def func(parser, options, args):
     if len(args) >= 1:
         repository = args[0]
     else:
-        repository = config.get('branch.%s.remote' % git.get_head_file())
-        if not repository:
-            repository = 'origin'
+        repository = crt_series.get_parent_remote()
 
     refspec = None
     if len(args) == 2:
diff --git a/stgit/stack.py b/stgit/stack.py
index 087403f..026fc36 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -398,6 +398,16 @@ class Series(StgitObject):
     def set_description(self, line):
         self._set_field('description', line)
 
+    def get_parent_remote(self):
+        value = config.get('branch.%s.remote' % self.__name)
+        if value:
+            return value
+        else:
+            return 'origin'
+
+    def __set_parent_remote(self, remote):
+        value = config.set('branch.%s.remote' % self.__name, remote)
+
     def __patch_is_current(self, patch):
         return patch.get_name() == self.get_current()
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help