Rename "stg coalesce" to "stg squash"
authorKarl Hasselström <kha@treskal.com>
Thu, 26 Feb 2009 20:13:37 +0000 (21:13 +0100)
committerKarl Hasselström <kha@treskal.com>
Thu, 26 Feb 2009 20:13:37 +0000 (21:13 +0100)
"squash" is the word git uses for this operation, so we should use it
too to lessen the confusion. Also, it's easier to spell.

We can do the rename without any effort at backwards compatibility
because "stg coalesce" has never been part of any released version.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Documentation/tutorial.txt
contrib/stgit.el
stgit/commands/refresh.py
stgit/commands/squash.py [moved from stgit/commands/coalesce.py with 81% similarity]
t/t2600-squash.sh [moved from t/t2600-coalesce.sh with 71% similarity]

index 283b358..44435f0 100644 (file)
@@ -172,7 +172,7 @@ pop the topmost patch, respectively.
 NOTE: There are at least two more ways to update a non-topmost patch.
 One is to use stglink:refresh[] with the +$$--patch$$+ flag, the other
 to create a new patch for the update and then merge it into the other
-patch with stglink:coalesce[].
+patch with stglink:squash[].
 
 
 Keeping commit messages up to date
@@ -405,8 +405,8 @@ At this point, there are a number of things we could do:
   * Use e.g. stglink:float[], stglink:sink[], stglink:push[], and
     stglink:pop[] to reorder patches.
 
-  * Use stglink:coalesce[] to merge two or more patches into one.
-    stgsublink:coalesce[] pushes and pops so that the patches to be
+  * Use stglink:squash[] to merge two or more patches into one.
+    stgsublink:squash[] pushes and pops so that the patches to be
     merged are consecutive and unrelated patches aren't in the way,
     then makes one big patch out of the patches to be merged, and
     finally pushes the other patches back.
index 7fd3786..02e43e1 100644 (file)
@@ -526,7 +526,7 @@ find copied files."
           ("r" .        stgit-refresh)
           ("\C-c\C-r" . stgit-rename)
           ("e" .        stgit-edit)
-          ("c" .        stgit-coalesce)
+          ("S" .        stgit-squash)
           ("N" .        stgit-new)
           ("R" .        stgit-repair)
           ("C" .        stgit-commit)
@@ -866,26 +866,26 @@ the work tree and index."
           (apply 'stgit-run "delete" args))
         (stgit-reload)))))
 
-(defun stgit-coalesce (patchsyms)
-  "Coalesce the patches in PATCHSYMS.
-Interactively, coalesce the marked patches."
+(defun stgit-squash (patchsyms)
+  "Squash the patches in PATCHSYMS.
+Interactively, squash the marked patches."
   (interactive (list stgit-marked-patches))
   (when (< (length patchsyms) 2)
-    (error "Need at least two patches to coalesce"))
+    (error "Need at least two patches to squash"))
   (let ((edit-buf (get-buffer-create "*StGit edit*"))
         (dir default-directory))
-    (log-edit 'stgit-confirm-coalesce t nil edit-buf)
+    (log-edit 'stgit-confirm-squash t nil edit-buf)
     (set (make-local-variable 'stgit-patchsyms) patchsyms)
     (setq default-directory dir)
     (let ((standard-output edit-buf))
-      (apply 'stgit-run-silent "coalesce" "--save-template=-" patchsyms))))
+      (apply 'stgit-run-silent "squash" "--save-template=-" patchsyms))))
 
-(defun stgit-confirm-coalesce ()
+(defun stgit-confirm-squash ()
   (interactive)
   (let ((file (make-temp-file "stgit-edit-")))
     (write-region (point-min) (point-max) file)
     (stgit-capture-output nil
-      (apply 'stgit-run "coalesce" "-f" file stgit-patchsyms))
+      (apply 'stgit-run "squash" "-f" file stgit-patchsyms))
     (with-current-buffer log-edit-parent-buffer
       (stgit-clear-marks)
       ;; Go to first marked patch and stay there
index 27cccc5..5a5f979 100644 (file)
@@ -41,7 +41,7 @@ with your updates, and then merges that patch into the patch you asked
 to have refreshed. If you asked to refresh a patch other than the
 topmost patch, there can be conflicts; in that case, the temporary
 patch will be left for you to take care of, for example with stg
-coalesce.
+squash.
 
 The creation of the temporary patch is recorded in a separate entry in
 the patch stack log; this means that one undo step will undo the merge
similarity index 81%
rename from stgit/commands/coalesce.py
rename to stgit/commands/squash.py
index 4b5c00a..f499037 100644 (file)
@@ -23,11 +23,11 @@ from stgit import argparse, utils
 from stgit.commands import common
 from stgit.lib import git, transaction
 
-help = 'Coalesce two or more patches into one'
+help = 'Squash two or more patches into one'
 kind = 'stack'
 usage = ['[options] <patches>']
 description = """
-Coalesce two or more patches, creating one big patch that contains all
+Squash two or more patches, creating one big patch that contains all
 their changes.
 
 If there are conflicts when reordering the patches to match the order
@@ -36,7 +36,7 @@ done a sequence of pushes and pops yourself."""
 
 args = [argparse.patch_range(argparse.applied_patches,
                              argparse.unapplied_patches)]
-options = [opt('-n', '--name', short = 'Name of coalesced patch')
+options = [opt('-n', '--name', short = 'Name of squashed patch')
            ] + argparse.message_options(save_template = True)
 
 directory = common.DirectoryHasRepositoryLib()
@@ -44,7 +44,7 @@ directory = common.DirectoryHasRepositoryLib()
 class SaveTemplateDone(Exception):
     pass
 
-def _coalesce_patches(trans, patches, msg, save_template):
+def _squash_patches(trans, patches, msg, save_template):
     cd = trans.patches[patches[0]].data
     cd = git.CommitData(tree = cd.tree, parents = cd.parents)
     for pn in patches[1:]:
@@ -63,12 +63,12 @@ def _coalesce_patches(trans, patches, msg, save_template):
             save_template(msg)
             raise SaveTemplateDone()
         else:
-            msg = utils.edit_string(msg, '.stgit-coalesce.txt').strip()
+            msg = utils.edit_string(msg, '.stgit-squash.txt').strip()
     cd = cd.set_message(msg)
 
     return cd
 
-def _coalesce(stack, iw, name, msg, save_template, patches):
+def _squash(stack, iw, name, msg, save_template, patches):
 
     # If a name was supplied on the command line, make sure it's OK.
     def bad_name(pn):
@@ -78,18 +78,18 @@ def _coalesce(stack, iw, name, msg, save_template, patches):
     if name and bad_name(name):
         raise common.CmdException('Patch name "%s" already taken')
 
-    def make_coalesced_patch(trans, new_commit_data):
+    def make_squashed_patch(trans, new_commit_data):
         name = get_name(new_commit_data)
         trans.patches[name] = stack.repository.commit(new_commit_data)
         trans.unapplied.insert(0, name)
 
-    trans = transaction.StackTransaction(stack, 'coalesce',
+    trans = transaction.StackTransaction(stack, 'squash',
                                          allow_conflicts = True)
     push_new_patch = bool(set(patches) & set(trans.applied))
     try:
-        new_commit_data = _coalesce_patches(trans, patches, msg, save_template)
+        new_commit_data = _squash_patches(trans, patches, msg, save_template)
         if new_commit_data:
-            # We were able to construct the coalesced commit
+            # We were able to construct the squashed commit
             # automatically. So just delete its constituent patches.
             to_push = trans.delete_patches(lambda pn: pn in patches)
         else:
@@ -99,10 +99,10 @@ def _coalesce(stack, iw, name, msg, save_template, patches):
             to_push = trans.pop_patches(lambda pn: pn in patches)
             for pn in patches:
                 trans.push_patch(pn, iw)
-            new_commit_data = _coalesce_patches(trans, patches, msg,
+            new_commit_data = _squash_patches(trans, patches, msg,
                                                 save_template)
             assert not trans.delete_patches(lambda pn: pn in patches)
-        make_coalesced_patch(trans, new_commit_data)
+        make_squashed_patch(trans, new_commit_data)
 
         # Push the new patch if necessary, and any unrelated patches we've
         # had to pop out of the way.
@@ -122,5 +122,5 @@ def func(parser, options, args):
     patches = common.parse_patches(args, list(stack.patchorder.all))
     if len(patches) < 2:
         raise common.CmdException('Need at least two patches')
-    return _coalesce(stack, stack.repository.default_iw, options.name,
-                     options.message, options.save_template, patches)
+    return _squash(stack, stack.repository.default_iw, options.name,
+                   options.message, options.save_template, patches)
similarity index 71%
rename from t/t2600-coalesce.sh
rename to t/t2600-squash.sh
index 9a043fd..3dba012 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-test_description='Run "stg coalesce"'
+test_description='Run "stg squash"'
 
 . ./test-lib.sh
 
@@ -14,16 +14,16 @@ test_expect_success 'Initialize StGit stack' '
     done
 '
 
-test_expect_success 'Coalesce some patches' '
+test_expect_success 'Squash some patches' '
     [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
-    stg coalesce --name=q0 --message="wee woo" p1 p2 &&
+    stg squash --name=q0 --message="wee woo" p1 p2 &&
     [ "$(echo $(stg series --applied --noprefix))" = "p0 q0 p3" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
 '
 
-test_expect_success 'Coalesce at stack top' '
-    stg coalesce --name=q1 --message="wee woo wham" q0 p3 &&
+test_expect_success 'Squash at stack top' '
+    stg squash --name=q1 --message="wee woo wham" q0 p3 &&
     [ "$(echo $(stg series --applied --noprefix))" = "p0 q1" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
 '
@@ -33,10 +33,10 @@ cat > editor <<EOF
 echo "Editor was invoked" | tee editor-invoked
 EOF
 chmod a+x editor
-test_expect_success 'Coalesce with top != head' '
+test_expect_success 'Squash with top != head' '
     echo blahonga >> foo.txt &&
     git commit -a -m "a new commit" &&
-    EDITOR=./editor command_error stg coalesce --name=r0 p0 q1 &&
+    EDITOR=./editor command_error stg squash --name=r0 p0 q1 &&
     test "$(echo $(stg series))" = "+ p0 > q1" &&
     test ! -e editor-invoked
 '