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