* [StGit PATCH 0/4] Reposting udpated patches
@ 2009-03-17 11:08 Catalin Marinas
2009-03-17 11:08 ` [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure Catalin Marinas
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Catalin Marinas @ 2009-03-17 11:08 UTC (permalink / raw)
To: git, Karl Hasselström
There are three patches which were updated after discussions and the
recommendation for the hidden argument to reorder_patches(). I haven't
reposted the acked patches.
Catalin Marinas (4):
Use a default "hidden" argument in StackTransaction.reorder_patches
Convert "float" to the lib infrastructure
Add automatic git-mergetool invocation to the new infrastructure
Add mergetool support to the classic StGit infrastructure
examples/gitconfig | 21 +-----
stgit/commands/edit.py | 2 -
stgit/commands/float.py | 80 +++++++++--------------
stgit/commands/goto.py | 2 -
stgit/commands/resolved.py | 5 -
stgit/commands/sink.py | 84 +++++++++++--------------
stgit/config.py | 1
stgit/git.py | 31 +++++----
stgit/gitmergeonefile.py | 150 --------------------------------------------
stgit/lib/git.py | 19 +++++-
stgit/lib/transaction.py | 11 ++-
t/t0002-status.sh | 3 -
t/t1501-sink.sh | 2 -
13 files changed, 114 insertions(+), 297 deletions(-)
delete mode 100644 stgit/gitmergeonefile.py
--
Catalin
^ permalink raw reply [flat|nested] 9+ messages in thread
* [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure
2009-03-17 11:08 [StGit PATCH 0/4] Reposting udpated patches Catalin Marinas
@ 2009-03-17 11:08 ` Catalin Marinas
2009-03-17 15:29 ` Karl Hasselström
2009-03-17 11:08 ` [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure Catalin Marinas
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2009-03-17 11:08 UTC (permalink / raw)
To: git, Karl Hasselström
Since Git already has a tool for interactively solving conflicts which
is highly customisable, there is no need to duplicate this feature via
the i3merge and i2merge configuration options. The user-visible change
is that now mergetool is invoked rather than the previously customised
interactive merging tool.
The stgit.keeporig option is no longer available to be more consistent
with the Git behaviour.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
examples/gitconfig | 21 +-----
stgit/commands/resolved.py | 5 -
stgit/config.py | 1
stgit/git.py | 31 +++++----
stgit/gitmergeonefile.py | 150 --------------------------------------------
t/t0002-status.sh | 3 -
6 files changed, 20 insertions(+), 191 deletions(-)
delete mode 100644 stgit/gitmergeonefile.py
diff --git a/examples/gitconfig b/examples/gitconfig
index 2fc5f52..f6e3a79 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -64,27 +64,10 @@
# To support local parent branches:
#pull-policy = rebase
- # Interactive two/three-way merge tool. It is executed by the
- # 'resolved --interactive' command
- #i3merge = xxdiff --title1 current --title2 ancestor --title3 patched \
- # --show-merged-pane -m -E -O -X -M \"%(output)s\" \
- # \"%(branch1)s\" \"%(ancestor)s\" \"%(branch2)s\"
- #i2merge = xxdiff --title1 current --title2 patched \
- # --show-merged-pane -m -E -O -X -M \"%(output)s\" \
- # \"%(branch1)s\" \"%(branch2)s\"
- #i3merge = emacs --eval '(ediff-merge-files-with-ancestor \
- # \"%(branch1)s\" \"%(branch2)s\" \"%(ancestor)s\" nil \
- # \"%(output)s\")'
- #i2merge = emacs --eval '(ediff-merge-files \
- # \"%(branch1)s\" \"%(branch2)s\" nil \"%(output)s\")'
-
- # Automatically invoke the interactive merger in case of conflicts
+ # Automatically invoke the interactive merger (git mergetool) in case
+ # of conflicts
#autoimerge = no
- # Leave the original files in the working tree in case of a
- # merge conflict
- #keeporig = yes
-
# Optimize (repack) the object store after every pull
#keepoptimized = yes
diff --git a/stgit/commands/resolved.py b/stgit/commands/resolved.py
index 2ce7ec3..eba778d 100644
--- a/stgit/commands/resolved.py
+++ b/stgit/commands/resolved.py
@@ -22,7 +22,6 @@ from stgit.commands.common import *
from stgit.utils import *
from stgit import argparse, stack, git, basedir
from stgit.config import config, file_extensions
-from stgit.gitmergeonefile import interactive_merge
help = 'Mark a file conflict as solved'
kind = 'wc'
@@ -78,8 +77,6 @@ def func(parser, options, args):
# resolved
if options.interactive:
- for filename in files:
- interactive_merge(filename)
- git.resolved([filename])
+ git.mergetool(files)
else:
git.resolved(files, options.reset)
diff --git a/stgit/config.py b/stgit/config.py
index 05ef624..efce097 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -35,7 +35,6 @@ class GitConfig:
'stgit.fetchcmd': 'git fetch',
'stgit.pull-policy': 'pull',
'stgit.autoimerge': 'no',
- 'stgit.keeporig': 'yes',
'stgit.keepoptimized': 'no',
'stgit.extensions': '.ancestor .current .patched',
'stgit.shortnr': '5'
diff --git a/stgit/git.py b/stgit/git.py
index 4d01fc2..cbdefe8 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os, re, gitmergeonefile
+import sys, os, re
from shutil import copyfile
from stgit.exception import *
@@ -632,19 +632,23 @@ def merge_recursive(base, head1, head2):
output = p.output_lines()
if p.exitcode:
# There were conflicts
- conflicts = [l.strip() for l in output if l.startswith('CONFLICT')]
+ if config.get('stgit.autoimerge') == 'yes':
+ mergetool()
+ else:
+ conflicts = [l for l in output if l.startswith('CONFLICT')]
+ out.info(*conflicts)
+ raise GitException, "%d conflict(s)" % len(conflicts)
+
+def mergetool(files = ()):
+ """Invoke 'git mergetool' to resolve any outstanding conflicts. If 'not
+ files', all the files in an unmerged state will be processed."""
+ GRun('mergetool', *list(files)).returns([0, 1]).run()
+ # check for unmerged entries (prepend 'CONFLICT ' for consistency with
+ # merge_recursive())
+ conflicts = ['CONFLICT ' + f for f in get_conflicts()]
+ if conflicts:
out.info(*conflicts)
-
- # try the interactive merge or stage checkout (if enabled)
- for filename in get_conflicts():
- if (gitmergeonefile.merge(filename)):
- # interactive merge succeeded
- resolved([filename])
-
- # any conflicts left unsolved?
- cn = len(get_conflicts())
- if cn:
- raise GitException, "%d conflict(s)" % cn
+ raise GitException, "%d conflict(s)" % len(conflicts)
def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = [],
binary = True):
@@ -754,7 +758,6 @@ def resolved(filenames, reset = None):
'--stdin', '-z').input_nulterm(filenames).no_output()
GRun('update-index', '--add', '--').xargs(filenames)
for filename in filenames:
- gitmergeonefile.clean_up(filename)
# update the access and modificatied times
os.utime(filename, None)
diff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py
deleted file mode 100644
index 1fe226e..0000000
--- a/stgit/gitmergeonefile.py
+++ /dev/null
@@ -1,150 +0,0 @@
-"""Performs a 3-way merge for GIT files
-"""
-
-__copyright__ = """
-Copyright (C) 2006, Catalin Marinas <catalin.marinas@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 as
-published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""
-
-import sys, os
-from stgit.exception import *
-from stgit import basedir
-from stgit.config import config, file_extensions, ConfigOption
-from stgit.utils import append_string
-from stgit.out import *
-from stgit.run import *
-
-class GitMergeException(StgException):
- pass
-
-
-#
-# Options
-#
-autoimerge = ConfigOption('stgit', 'autoimerge')
-keeporig = ConfigOption('stgit', 'keeporig')
-
-#
-# Utility functions
-#
-def __str2none(x):
- if x == '':
- return None
- else:
- return x
-
-class MRun(Run):
- exc = GitMergeException # use a custom exception class on errors
-
-def __checkout_stages(filename):
- """Check-out the merge stages in the index for the give file
- """
- extensions = file_extensions()
- line = MRun('git', 'checkout-index', '--stage=all', '--', filename
- ).output_one_line()
- stages, path = line.split('\t')
- stages = dict(zip(['ancestor', 'current', 'patched'],
- stages.split(' ')))
-
- for stage, fn in stages.iteritems():
- if stages[stage] == '.':
- stages[stage] = None
- else:
- newname = filename + extensions[stage]
- if os.path.exists(newname):
- # remove the stage if it is already checked out
- os.remove(newname)
- os.rename(stages[stage], newname)
- stages[stage] = newname
-
- return stages
-
-def __remove_stages(filename):
- """Remove the merge stages from the working directory
- """
- extensions = file_extensions()
- for ext in extensions.itervalues():
- fn = filename + ext
- if os.path.isfile(fn):
- os.remove(fn)
-
-def interactive_merge(filename):
- """Run the interactive merger on the given file. Stages will be
- removed according to stgit.keeporig. If successful and stages
- kept, they will be removed via git.resolved().
- """
- stages = __checkout_stages(filename)
-
- try:
- # Check whether we have all the files for the merge.
- if not (stages['current'] and stages['patched']):
- raise GitMergeException('Cannot run the interactive merge')
-
- if stages['ancestor']:
- three_way = True
- files_dict = {'branch1': stages['current'],
- 'ancestor': stages['ancestor'],
- 'branch2': stages['patched'],
- 'output': filename}
- imerger = config.get('stgit.i3merge')
- else:
- three_way = False
- files_dict = {'branch1': stages['current'],
- 'branch2': stages['patched'],
- 'output': filename}
- imerger = config.get('stgit.i2merge')
-
- if not imerger:
- raise GitMergeException, 'No interactive merge command configured'
-
- mtime = os.path.getmtime(filename)
-
- out.start('Trying the interactive %s merge'
- % (three_way and 'three-way' or 'two-way'))
- err = os.system(imerger % files_dict)
- out.done()
- if err != 0:
- raise GitMergeException, 'The interactive merge failed'
- if not os.path.isfile(filename):
- raise GitMergeException, 'The "%s" file is missing' % filename
- if mtime == os.path.getmtime(filename):
- raise GitMergeException, 'The "%s" file was not modified' % filename
- finally:
- # keep the merge stages?
- if str(keeporig) != 'yes':
- __remove_stages(filename)
-
-def clean_up(filename):
- """Remove merge conflict stages if they were generated.
- """
- if str(keeporig) == 'yes':
- __remove_stages(filename)
-
-def merge(filename):
- """Merge one file if interactive is allowed or check out the stages
- if keeporig is set.
- """
- if str(autoimerge) == 'yes':
- try:
- interactive_merge(filename)
- except GitMergeException, ex:
- out.error(str(ex))
- return False
- return True
-
- if str(keeporig) == 'yes':
- __checkout_stages(filename)
-
- return False
diff --git a/t/t0002-status.sh b/t/t0002-status.sh
index ac92aa8..d95a83b 100755
--- a/t/t0002-status.sh
+++ b/t/t0002-status.sh
@@ -107,9 +107,6 @@ test_expect_success 'Make a conflicting patch' '
'
cat > expected.txt <<EOF
-? foo/bar.ancestor
-? foo/bar.current
-? foo/bar.patched
A fie
C foo/bar
EOF
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure
2009-03-17 11:08 [StGit PATCH 0/4] Reposting udpated patches Catalin Marinas
2009-03-17 11:08 ` [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure Catalin Marinas
@ 2009-03-17 11:08 ` Catalin Marinas
2009-03-17 15:30 ` Karl Hasselström
2009-03-17 11:09 ` [StGit PATCH 3/4] Convert "float" to the lib infrastructure Catalin Marinas
2009-03-17 11:09 ` [StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches Catalin Marinas
3 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2009-03-17 11:08 UTC (permalink / raw)
To: git, Karl Hasselström
This patch adds the IndexAndWorktree.mergetool() function responsible
for calling 'git mergetool' to interactively solve conflicts. The
function may also be called from IndexAndWorktree.merge() if the
standard 'git merge-recursive' fails and 'interactive == True'. The
'allow_interactive' parameter is passed to Transaction.push_patch() from
the functions allowing interactive merging.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/edit.py | 2 +-
stgit/commands/goto.py | 2 +-
stgit/lib/git.py | 19 ++++++++++++++++---
stgit/lib/transaction.py | 7 +++++--
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index ed785aa..42eb792 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -128,7 +128,7 @@ def func(parser, options, args):
trans.patches[patchname] = stack.repository.commit(cd)
try:
for pn in popped:
- trans.push_patch(pn, iw)
+ trans.push_patch(pn, iw, allow_interactive = True)
except transaction.TransactionHalted:
pass
try:
diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py
index 480266a..66f49df 100644
--- a/stgit/commands/goto.py
+++ b/stgit/commands/goto.py
@@ -48,7 +48,7 @@ def func(parser, options, args):
elif patch in trans.unapplied:
try:
for pn in trans.unapplied[:trans.unapplied.index(patch)+1]:
- trans.push_patch(pn, iw)
+ trans.push_patch(pn, iw, allow_interactive = True)
except transaction.TransactionHalted:
pass
elif patch in trans.hidden:
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 07079b8..e0a3c96 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -824,7 +824,7 @@ class IndexAndWorktree(RunWithEnvCwd):
).discard_output()
except run.RunException:
raise CheckoutException('Index/workdir dirty')
- def merge(self, base, ours, theirs):
+ def merge(self, base, ours, theirs, interactive = False):
assert isinstance(base, Tree)
assert isinstance(ours, Tree)
assert isinstance(theirs, Tree)
@@ -838,10 +838,23 @@ class IndexAndWorktree(RunWithEnvCwd):
output = r.output_lines()
if r.exitcode:
# There were conflicts
- conflicts = [l for l in output if l.startswith('CONFLICT')]
- raise MergeConflictException(conflicts)
+ if interactive:
+ self.mergetool()
+ else:
+ conflicts = [l for l in output if l.startswith('CONFLICT')]
+ raise MergeConflictException(conflicts)
except run.RunException, e:
raise MergeException('Index/worktree dirty')
+ def mergetool(self, files = ()):
+ """Invoke 'git mergetool' on the current IndexAndWorktree to resolve
+ any outstanding conflicts. If 'not files', all the files in an
+ unmerged state will be processed."""
+ run.Run(['git', 'mergetool'] + list(files)).returns([0, 1]).run()
+ # check for unmerged entries (prepend 'CONFLICT ' for consistency with
+ # merge())
+ conflicts = ['CONFLICT ' + f for f in self.index.conflicts()]
+ if conflicts:
+ raise MergeConflictException(conflicts)
def changed_files(self, tree, pathlimits = []):
"""Return the set of files in the worktree that have changed with
respect to C{tree}. The listing is optionally restricted to
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index a88d289..4b5398a 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -8,6 +8,7 @@ from stgit import exception, utils
from stgit.utils import any, all
from stgit.out import *
from stgit.lib import git, log
+from stgit.config import config
class TransactionException(exception.StgException):
"""Exception raised when something goes wrong with a
@@ -296,7 +297,7 @@ class StackTransaction(object):
out.info('Deleted %s%s' % (pn, s))
return popped
- def push_patch(self, pn, iw = None):
+ def push_patch(self, pn, iw = None, allow_interactive = False):
"""Attempt to push the named patch. If this results in conflicts,
halts the transaction. If index+worktree are given, spill any
conflicts to them."""
@@ -319,7 +320,9 @@ class StackTransaction(object):
except git.CheckoutException:
self.__halt('Index/worktree dirty')
try:
- iw.merge(base, ours, theirs)
+ interactive = (allow_interactive and
+ config.get('stgit.autoimerge') == 'yes')
+ iw.merge(base, ours, theirs, interactive = interactive)
tree = iw.index.write_tree()
self.__current_tree = tree
s = ' (modified)'
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [StGit PATCH 3/4] Convert "float" to the lib infrastructure
2009-03-17 11:08 [StGit PATCH 0/4] Reposting udpated patches Catalin Marinas
2009-03-17 11:08 ` [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure Catalin Marinas
2009-03-17 11:08 ` [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure Catalin Marinas
@ 2009-03-17 11:09 ` Catalin Marinas
2009-03-17 16:34 ` Karl Hasselström
2009-03-17 11:09 ` [StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches Catalin Marinas
3 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2009-03-17 11:09 UTC (permalink / raw)
To: git, Karl Hasselström
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/float.py | 89 +++++++++++++++++++----------------------------
1 files changed, 36 insertions(+), 53 deletions(-)
diff --git a/stgit/commands/float.py b/stgit/commands/float.py
index 7c3dcdf..8410675 100644
--- a/stgit/commands/float.py
+++ b/stgit/commands/float.py
@@ -16,11 +16,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os
+import sys
from stgit.argparse import opt
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit import argparse, stack, git
+from stgit.commands import common
+from stgit.lib import transaction
+from stgit import argparse
help = 'Push patches to the top, even if applied'
kind = 'stack'
@@ -35,32 +35,27 @@ as specified by the given series file (or the standard input)."""
args = [argparse.patch_range(argparse.applied_patches,
argparse.unapplied_patches)]
options = [
- opt('-s', '--series', action = 'store_true',
- short = 'Rearrange according to a series file')]
+ opt('-s', '--series', metavar = 'FILE',
+ short = 'Rearrange according to the series FILE')
+ ] + argparse.keep_option()
-directory = DirectoryGotoToplevel(log = True)
+directory = common.DirectoryHasRepositoryLib()
def func(parser, options, args):
- """Pops and pushed to make the named patch the topmost patch
+ """Reorder patches to make the named patch the topmost one.
"""
- args_nr = len(args)
- if (options.series and args_nr > 1) \
- or (not options.series and args_nr == 0):
+ if options.series and args:
+ parser.error('<patches> cannot be used with --series')
+ elif not options.series and not args:
parser.error('incorrect number of arguments')
- check_local_changes()
- check_conflicts()
- check_head_top_equal(crt_series)
-
- unapplied = crt_series.get_unapplied()
- applied = crt_series.get_applied()
- all = unapplied + applied
+ stack = directory.repository.current_stack
if options.series:
- if args_nr:
- f = file(args[0])
- else:
+ if options.series == '-':
f = sys.stdin
+ else:
+ f = file(args[0])
patches = []
for line in f:
@@ -68,35 +63,23 @@ def func(parser, options, args):
if patch:
patches.append(patch)
else:
- patches = parse_patches(args, all)
-
- # working with "topush" patches in reverse order might be a bit
- # more efficient for large series but the main reason is for the
- # "topop != topush" comparison to work
- patches.reverse()
-
- topush = []
- topop = []
-
- for p in patches:
- while p in applied:
- top = applied.pop()
- if not top in patches:
- topush.append(top)
- topop.append(top)
- topush = patches + topush
-
- # remove common patches to avoid unnecessary pop/push
- while topush and topop:
- if topush[-1] != topop[-1]:
- break
- topush.pop()
- topop.pop()
-
- # check whether the operation is really needed
- if topop != topush:
- if topop:
- pop_patches(crt_series, topop)
- if topush:
- topush.reverse()
- push_patches(crt_series, topush)
+ patches = common.parse_patches(args, stack.patchorder.all)
+
+ if not patches:
+ raise common.CmdException('No patches to float')
+
+ applied = [p for p in stack.patchorder.applied if p not in patches] + \
+ patches
+ unapplied = [p for p in stack.patchorder.unapplied if not p in patches]
+ hidden = list(stack.patchorder.hidden)
+
+ iw = stack.repository.default_iw
+ clean_iw = (not options.keep and iw) or None
+ trans = transaction.StackTransaction(stack, 'sink',
+ check_clean_iw = clean_iw)
+
+ try:
+ trans.reorder_patches(applied, unapplied, hidden, iw)
+ except transaction.TransactionHalted:
+ pass
+ return trans.run(iw)
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches
2009-03-17 11:08 [StGit PATCH 0/4] Reposting udpated patches Catalin Marinas
` (2 preceding siblings ...)
2009-03-17 11:09 ` [StGit PATCH 3/4] Convert "float" to the lib infrastructure Catalin Marinas
@ 2009-03-17 11:09 ` Catalin Marinas
2009-03-17 16:38 ` Karl Hasselström
3 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2009-03-17 11:09 UTC (permalink / raw)
To: git, Karl Hasselström
This argument is rarely used so adding a default value simplifies the
calling code.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/float.py | 3 +--
stgit/commands/sink.py | 4 +---
stgit/lib/transaction.py | 4 +++-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/stgit/commands/float.py b/stgit/commands/float.py
index 8410675..e561c39 100644
--- a/stgit/commands/float.py
+++ b/stgit/commands/float.py
@@ -71,7 +71,6 @@ def func(parser, options, args):
applied = [p for p in stack.patchorder.applied if p not in patches] + \
patches
unapplied = [p for p in stack.patchorder.unapplied if not p in patches]
- hidden = list(stack.patchorder.hidden)
iw = stack.repository.default_iw
clean_iw = (not options.keep and iw) or None
@@ -79,7 +78,7 @@ def func(parser, options, args):
check_clean_iw = clean_iw)
try:
- trans.reorder_patches(applied, unapplied, hidden, iw)
+ trans.reorder_patches(applied, unapplied, iw = iw)
except transaction.TransactionHalted:
pass
return trans.run(iw)
diff --git a/stgit/commands/sink.py b/stgit/commands/sink.py
index 641ab7b..63be461 100644
--- a/stgit/commands/sink.py
+++ b/stgit/commands/sink.py
@@ -81,9 +81,7 @@ def func(parser, options, args):
else:
insert_idx = 0
applied = applied[:insert_idx] + patches + applied[insert_idx:]
-
unapplied = [p for p in stack.patchorder.unapplied if p not in patches]
- hidden = list(stack.patchorder.hidden)
iw = stack.repository.default_iw
clean_iw = (not options.keep and iw) or None
@@ -91,7 +89,7 @@ def func(parser, options, args):
check_clean_iw = clean_iw)
try:
- trans.reorder_patches(applied, unapplied, hidden, iw)
+ trans.reorder_patches(applied, unapplied, iw = iw)
except transaction.TransactionHalted:
pass
return trans.run(iw)
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index 4b5398a..b146648 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -365,8 +365,10 @@ class StackTransaction(object):
# Update immediately.
update()
- def reorder_patches(self, applied, unapplied, hidden, iw = None):
+ def reorder_patches(self, applied, unapplied, hidden = None, iw = None):
"""Push and pop patches to attain the given ordering."""
+ if hidden is None:
+ hidden = self.hidden
common = len(list(it.takewhile(lambda (a, b): a == b,
zip(self.applied, applied))))
to_pop = set(self.applied[common:])
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure
2009-03-17 11:08 ` [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure Catalin Marinas
@ 2009-03-17 15:29 ` Karl Hasselström
0 siblings, 0 replies; 9+ messages in thread
From: Karl Hasselström @ 2009-03-17 15:29 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
On 2009-03-17 11:08:53 +0000, Catalin Marinas wrote:
> Since Git already has a tool for interactively solving conflicts
> which is highly customisable, there is no need to duplicate this
> feature via the i3merge and i2merge configuration options. The
> user-visible change is that now mergetool is invoked rather than the
> previously customised interactive merging tool.
>
> The stgit.keeporig option is no longer available to be more
> consistent with the Git behaviour.
Acked-by: Karl Hasselström <kha@treskal.com>
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure
2009-03-17 11:08 ` [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure Catalin Marinas
@ 2009-03-17 15:30 ` Karl Hasselström
0 siblings, 0 replies; 9+ messages in thread
From: Karl Hasselström @ 2009-03-17 15:30 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
On 2009-03-17 11:08:58 +0000, Catalin Marinas wrote:
> This patch adds the IndexAndWorktree.mergetool() function
> responsible for calling 'git mergetool' to interactively solve
> conflicts. The function may also be called from
> IndexAndWorktree.merge() if the standard 'git merge-recursive' fails
> and 'interactive == True'. The 'allow_interactive' parameter is
> passed to Transaction.push_patch() from the functions allowing
> interactive merging.
Acked-by: Karl Hasselström <kha@treskal.com>
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [StGit PATCH 3/4] Convert "float" to the lib infrastructure
2009-03-17 11:09 ` [StGit PATCH 3/4] Convert "float" to the lib infrastructure Catalin Marinas
@ 2009-03-17 16:34 ` Karl Hasselström
0 siblings, 0 replies; 9+ messages in thread
From: Karl Hasselström @ 2009-03-17 16:34 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
On 2009-03-17 11:09:04 +0000, Catalin Marinas wrote:
> Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
Acked-by: Karl Hasselström <kha@treskal.com>
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches
2009-03-17 11:09 ` [StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches Catalin Marinas
@ 2009-03-17 16:38 ` Karl Hasselström
0 siblings, 0 replies; 9+ messages in thread
From: Karl Hasselström @ 2009-03-17 16:38 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
On 2009-03-17 11:09:10 +0000, Catalin Marinas wrote:
> This argument is rarely used so adding a default value simplifies
> the calling code.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
Acked-by: Karl Hasselström <kha@treskal.com>
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-03-17 16:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-17 11:08 [StGit PATCH 0/4] Reposting udpated patches Catalin Marinas
2009-03-17 11:08 ` [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure Catalin Marinas
2009-03-17 15:29 ` Karl Hasselström
2009-03-17 11:08 ` [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure Catalin Marinas
2009-03-17 15:30 ` Karl Hasselström
2009-03-17 11:09 ` [StGit PATCH 3/4] Convert "float" to the lib infrastructure Catalin Marinas
2009-03-17 16:34 ` Karl Hasselström
2009-03-17 11:09 ` [StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches Catalin Marinas
2009-03-17 16:38 ` Karl Hasselström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox