git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yann Dirson <ydirson@altern.org>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH 2/6] Move identification of parent branch's remote def up into stack class.
Date: Sat, 27 Jan 2007 18:22:38 +0100	[thread overview]
Message-ID: <20070127172238.27183.36508.stgit@gandelf.nowhere.earth> (raw)
In-Reply-To: <20070127172129.27183.50432.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 |    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()
 

  parent reply	other threads:[~2007-01-27 17:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-27 17:22 [PATCH 0/7] [DRAFT 2] StGIT, remotes, and parent information Yann Dirson
2007-01-27 17:22 ` [PATCH 1/6] Make stgit.config use git-repo-config Yann Dirson
2007-01-27 17:22 ` Yann Dirson [this message]
2007-01-27 17:22 ` [PATCH 3/6] Allows extraction of information about remotes Yann Dirson
2007-01-27 17:22 ` [PATCH 4/6] Basic support for keeping a ref to the parent branch Yann Dirson
2007-01-27 17:22 ` [PATCH 5/6] Have 'stg branch --create' record parent information Yann Dirson
2007-01-27 17:22 ` [PATCH 6/6] Make 'stg pull' use git-fetch and not git-pull Yann Dirson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070127172238.27183.36508.stgit@gandelf.nowhere.earth \
    --to=ydirson@altern.org \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).