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

[PATCH 07/10] Stop recording branch.*.remote to '.' for local parents.

From
Yann Dirson <ydirson@altern.org>
Date
Mar 15, 2007, 00:27 UTC
Message-ID
<20070315002705.9094.21878.stgit@gandelf.nowhere.earth>
In-Reply-To
<20070315001808.9094.68529.stgit@gandelf.nowhere.earth>

We should be using the remote name of the remote branch in branch.*.merge, instead of the local one as we currently do (I'll ensure this in a later patch).

As a consequence, setting "remote" to '.' and "merge" to the name of a *local* parent would become inconsistent with the remote case. Anyway the local case should make use of pull-policy=rebase instead, and this change revealed that we were fetching useless information in the local case (no need for a remote).

Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 stgit/commands/pull.py |   24 +++++++++++++++++-------
 stgit/stack.py         |    4 +---
 2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 7b3c90c..f551b98 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -50,13 +50,25 @@ options = [make_option('-n', '--nopush',
 def func(parser, options, args):
     """Pull the changes from a remote repository
     """
-    if len(args) > 1:
-        parser.error('incorrect number of arguments')
+    policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_branch()) or \
+             config.get('stgit.pull-policy')
+
+    if policy == 'rebase':
+        # parent is local
+        if len(args) == 1:
+            parser.error('specifying a repository is meaningless for policy="%s"' % policy)
+        if len(args) > 0:
+            parser.error('incorrect number of arguments')
 
-    if len(args) >= 1:
-        repository = args[0]
     else:
-        repository = crt_series.get_parent_remote()
+        # parent is remote
+        if len(args) > 1:
+            parser.error('incorrect number of arguments')
+
+        if len(args) >= 1:
+            repository = args[0]
+        else:
+            repository = crt_series.get_parent_remote()
 
     if crt_series.get_protected():
         raise CmdException, 'This branch is protected. Pulls are not permitted'
@@ -65,8 +77,6 @@ def func(parser, options, args):
     check_conflicts()
     check_head_top_equal()
 
-    policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_branch()) or \
-             config.get('stgit.pull-policy')
     if policy == 'pull':
         must_rebase = 0
     elif policy == 'fetch-rebase':
diff --git a/stgit/stack.py b/stgit/stack.py
index d1b04ca..c3dab68 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -450,10 +450,8 @@ class Series(StgitObject):
         config.set('branch.%s.stgit.parentbranch' % self.__name, name)
 
     def set_parent(self, remote, localbranch):
-        # policy: record local branches as remote='.'
-        recordremote = remote or '.'
         if localbranch:
-            self.__set_parent_remote(recordremote)
+            self.__set_parent_remote(remote)
             self.__set_parent_branch(localbranch)
         # We'll enforce this later
 #         else:
Previous: Yann DirsonNext: Yann Dirson
Message 8 of 11 in “Various fixes and improvements”
  1. 00/10 Various fixes and improvementsYann Dirson, Mar 15, 2007
  2. 01/10 Fix stack deletion when orig-base is present.Yann Dirson, Mar 15, 2007
  3. 02/10 Fix diagnostic messages on patch deletion and simplify others.Yann Dirson, Mar 15, 2007
  4. 03/10 Make use exception raised by removedirs.Yann Dirson, Mar 15, 2007
  5. 04/10 Drop utils.remove_dirs() in favor of os.removedirs().Yann Dirson, Mar 15, 2007
  6. 05/10 Copy parentbranch setting on 'stg branch --clone'.Yann Dirson, Mar 15, 2007
  7. 06/10 Remove debugging output from contrib/stg-sinkYann Dirson, Mar 15, 2007
  8. 07/10 Stop recording branch.*.remote to '.' for local parents.Yann Dirson, Mar 15, 2007
  9. 08/10 Add a script to quickly run an interactive test session.Yann Dirson, Mar 15, 2007
  10. 09/10 Add support for unsetting config vars.Yann Dirson, Mar 15, 2007
  11. 10/10 Cleanup parent information on stgit branch deletion.Yann Dirson, Mar 15, 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.