git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Yann Dirson <ydirson@altern.org>
Date
Jan 27, 2007, 11:21 UTC
Message-ID
<20070127112117.16475.79541.stgit@gandelf.nowhere.earth>
In-Reply-To
<20070127104024.16475.81445.stgit@gandelf.nowhere.earth>

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 <ydirson@altern.org>
---
 stgit/commands/pull.py |    6 +-----
 stgit/stack.py         |   13 +++++++++++++
 2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 7c5db22..1a948be 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -53,11 +53,7 @@ def func(parser, options, args):
     if len(args) >= 1:
         repository = args[0]
     else:
-        section = 'branch "%s"' % git.get_head_file()
-        if config.has_option(section, 'remote'):
-            repository = config.get(section, 'remote')
-        else:
-            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 2ae4dd5..e801f42 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -397,6 +397,19 @@ class Series(StgitObject):
     def set_description(self, line):
         self._set_field('description', line)
 
+    def get_parent_remote(self):
+        section = 'branch "%s"' % self.__name
+        if config.has_option(section, 'remote'):
+            return config.get(section, 'remote')
+        else:
+            return 'origin'
+
+    def __set_parent_remote(self, remote):
+        section = 'branch "%s"' % self.__name
+        if not config.has_section(section):
+            config.add_section(section)
+        config.set(section, 'remote', remote)
+
     def __patch_is_current(self, patch):
         return patch.get_name() == self.get_current()
 
Previous: Yann DirsonNext: Yann Dirson
Message 2 of 6 in “[DRAFT] StGIT, remotes, and parent information”
  1. 0/5 [DRAFT] StGIT, remotes, and parent informationYann Dirson, Jan 27, 2007
  2. 1/5 Move identification of parent branch's remote def up into stack class.Yann Dirson, Jan 27, 2007
  3. 2/5 Allows extraction of information about remotes.Yann Dirson, Jan 27, 2007
  4. 3/5 Basic support for keeping a ref to the parent branch.Yann Dirson, Jan 27, 2007
  5. 4/5 Have 'stg branch --create' record parent information.Yann Dirson, Jan 27, 2007
  6. 5/5 Make 'stg pull' use git-fetch and not git-pull.Yann Dirson, Jan 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.