[PATCH 0/2] Series short description

STALE3710d

Revision v1 of 3 in this series.

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

[PATCH 0/2] Series short description

From: Yann Dirson <hidden>
Date: 2016-06-15 22:42:37

The following series allow to pick from all over the tree, even if your tree
is full of merge commits, and if you use grafts extensively.

The series is not really complete, it lacks a fix for a nasty bug that
crashes stgit when "pick" encounters a file-creation conflict.  But
nevertheless, I would not have been able to do my job today without them :)
-- 
Yann Dirson    [off-list ref] |
Debian-related: [off-list ref] |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

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

From: Yann Dirson <hidden>
Date: 2016-06-15 22:42:37

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 <redacted>
---

 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):

[PATCH 1/2] Add a --parent flag to "stgit pick".

From: Yann Dirson <hidden>
Date: 2016-06-15 22:42:37

This is useful to pick changes from a non-stgit branch, that were
recorded as a merge commit, while giving control on the parent to
use as "bottom" for the patch (for some reason stgit selects the
first parent by default).

Incidentally, it can be used to pick changes between arbitrary
trees in the revision graph.  Since that can be useful as well,
I did not implement the is_parent check I originally meant to add.

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

 stgit/commands/pick.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/pick.py b/stgit/commands/pick.py
index 1aa83d0..2916b6e 100644
--- a/stgit/commands/pick.py
+++ b/stgit/commands/pick.py
@@ -37,6 +37,8 @@ options = [make_option('-n', '--name',
            make_option('-r', '--reverse',
                        help = 'reverse the commit object before importing',
                        action = 'store_true'),
+           make_option('-p', '--parent',
+                       help = 'use COMMITID as parent'),
            make_option('--fold',
                        help = 'fold the commit object into the current patch',
                        action = 'store_true'),
@@ -73,12 +75,17 @@ def func(parser, options, args):
             if not patch:
                 raise CmdException, 'Unknown patch name'
 
+    if options.parent:
+        parent = options.parent
+    else:
+        parent = commit.get_parent()
+
     if not options.reverse:
-        bottom = commit.get_parent()
+        bottom = parent
         top = commit_id
     else:
         bottom = commit_id
-        top = commit.get_parent()
+        top = parent
 
     if options.fold:
         print 'Folding commit %s...' % commit_id,

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

From: Catalin Marinas <hidden>
Date: 2016-06-15 22:42:37

On 14/08/06, Yann Dirson [off-list ref] wrote:
This has the direct effect of taking info/grafts into account, since
ignoring it only causes confusion.
I don't know the difference but is there any between parsing the
commit file and using git-rev-list --parents?
+        self.__parents = split(_output_lines('git-rev-list --parents --max-count=1 %s' % id_hash)[0])[1:]
Instead of using the split() method, you could call
_output_lines('git-rev-list --parents --max-count=1 %s' %
id_hash)[0].split()[1:]. Maybe that's why they might deprecate the
global split method.

Setting self.__parents by calling get-rev-list would have a
performance impact on the push operation. I think we could remove the
__parents variable and only call git-rev-parse in get_parents() or
get_parent().

-- 
Catalin

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

From: Yann Dirson <hidden>
Date: 2016-06-15 22:42:39

On Sun, Aug 20, 2006 at 11:43:22AM +0100, Catalin Marinas wrote:
On 14/08/06, Yann Dirson [off-list ref] wrote:
quoted
This has the direct effect of taking info/grafts into account, since
ignoring it only causes confusion.
I don't know the difference but is there any between parsing the
commit file and using git-rev-list --parents?
Yes, git-rev-list at least takes info/grafts into account.
quoted
+        self.__parents = split(_output_lines('git-rev-list --parents 
--max-count=1 %s' % id_hash)[0])[1:]
Instead of using the split() method, you could call
_output_lines('git-rev-list --parents --max-count=1 %s' %
id_hash)[0].split()[1:]. Maybe that's why they might deprecate the
global split method.
Ah, OK.

Best regards,
-- 
Yann.

-- 
VGER BF report: U 0.500235
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help