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

[PATCH 2/2] Look for a commit's parents in the standard way.

From
Yann Dirson <ydirson@altern.org>
Date
Aug 14, 2006, 16:55 UTC
Message-ID
<20060814165544.20350.41590.stgit@gandelf.nowhere.earth>
In-Reply-To
<20060814165307.20350.63286.stgit@gandelf.nowhere.earth>

This has the direct effect of taking info/grafts into account, since ignoring it only causes confusion.

My original implementation was pasted from the same fix applied to cogito some time ago. That one is hopefully more pythonic, but it looks like split() is deprecated for some reason, and I don't know what should be used instead.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 stgit/git.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/stgit/git.py b/stgit/git.py
index c8b7b8f..68b547c 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite
 """
 
 import sys, os, popen2, re, gitmergeonefile
+from string import split
 
 from stgit import basedir
 from stgit.utils import *
@@ -47,12 +48,13 @@ class Commit:
             field = line.strip().split(' ', 1)
             if field[0] == 'tree':
                 self.__tree = field[1]
-            elif field[0] == 'parent':
-                self.__parents.append(field[1])
-            if field[0] == 'author':
+            #elif field[0] == 'parent':
+                #self.__parents.append(field[1])
+            elif field[0] == 'author':
                 self.__author = field[1]
-            if field[0] == 'committer':
+            elif field[0] == 'committer':
                 self.__committer = field[1]
+        self.__parents = split(_output_lines('git-rev-list --parents --max-count=1 %s' % id_hash)[0])[1:]
         self.__log = ''.join(lines[i+1:])
 
     def get_id_hash(self):
Previous: Yann DirsonNext: Catalin Marinas
Message 3 of 6 in “Series short description”
  1. 0/2 Series short descriptionYann Dirson, Aug 14, 2006
  2. 1/2 Add a --parent flag to "stgit pick".Yann Dirson, Aug 14, 2006
  3. 2/2 Look for a commit's parents in the standard way.Yann Dirson, Aug 14, 2006
  4. Catalin MarinasAug 20, 2006
  5. Junio C HamanoAug 22, 2006
  6. Yann DirsonSep 3, 2006

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.