git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [StGit PATCH 00/17] Series short description
@ 2007-12-14 10:55 David Kågedal
  2007-12-14 10:55 ` [StGit PATCH 01/17] Add an StGit mode for emacs David Kågedal
                   ` (17 more replies)
  0 siblings, 18 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:55 UTC (permalink / raw
  To: catalin.marinas, git

The following series an emacs interface to stgit patch stacks. It
shows a buffer with the the output of "stg series" and allows you to
do some common operations on it, such as push/pop, commit/uncommit,
edit, rename, repair, and coalesce.

The coalesce command obviosly requires the kha/experimental branch.
The edit command requires the edit fixes in kha/safe.

---

David Kågedal (10):
      Emacs mode: coalesce command
      Emacs mode: Add mark command
      Emacs mode: Added stgit-new
      Emacs mode: added fontification
      Emacs mode: Add stgit-edit command
      Emacs mode: added stgit-commit and stgit-uncommit
      Emacs mode: add stgit-repair
      Emacs mode: Bind n and p
      Emacs mode: Improve the output buffer state
      Add an StGit mode for emacs

Karl Hasselström (7):
      Emacs mode: show patches' short description
      Emacs mode: Bind "G" to "stg goto"
      Emacs mode: Let "P" push or pop patch at point
      Emacs mode: push/pop next patch, not patch at point
      Emacs mode: Makefile for building stgit.el
      Emacs mode: Add an explanatory header
      Emacs mode: Show keybindings when user presses "h" or "?"


 contrib/Makefile |   19 +++
 contrib/stgit.el |  377 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 396 insertions(+), 0 deletions(-)
 create mode 100644 contrib/Makefile
 create mode 100644 contrib/stgit.el

-- 
Signature

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [StGit PATCH 01/17] Add an StGit mode for emacs
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
@ 2007-12-14 10:55 ` David Kågedal
  2007-12-14 10:56 ` [StGit PATCH 02/17] Emacs mode: Show keybindings when user presses "h" or "?" David Kågedal
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:55 UTC (permalink / raw
  To: catalin.marinas, git

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---

 contrib/stgit.el |  141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 141 insertions(+), 0 deletions(-)
 create mode 100644 contrib/stgit.el


diff --git a/contrib/stgit.el b/contrib/stgit.el
new file mode 100644
index 0000000..1bdc0a5
--- /dev/null
+++ b/contrib/stgit.el
@@ -0,0 +1,141 @@
+(defun stgit (dir)
+  "Manage stgit patches"
+  (interactive "DDirectory: \n")
+  (switch-to-stgit-buffer dir)
+  (stgit-refresh))
+
+(defun switch-to-stgit-buffer (dir)
+  "Switch to a (possibly new) buffer displaying StGit patches for DIR"
+  (setq dir (file-name-as-directory dir))
+  (let ((buffers (buffer-list)))
+    (while (and buffers
+                (not (with-current-buffer (car buffers)
+                       (and (eq major-mode 'stgit-mode)
+                            (string= default-directory dir)))))
+      (setq buffers (cdr buffers)))
+    (switch-to-buffer (if buffers
+                          (car buffers)
+                        (create-stgit-buffer dir)))))
+
+(defun create-stgit-buffer (dir)
+  "Create a buffer for showing StGit patches.
+Argument DIR is the repository path."
+  (let ((buf (create-file-buffer (concat dir "*stgit*")))
+        (inhibit-read-only t))
+    (with-current-buffer buf
+      (setq default-directory dir)
+      (stgit-mode)
+      (setq buffer-read-only t))
+    buf))
+
+(defmacro stgit-capture-output (name &rest body)
+  "Capture StGit output and show it in a window at the end"
+  `(let ((output-buf (get-buffer-create ,(or name "*StGit output*"))))
+     (with-current-buffer output-buf
+       (erase-buffer))
+     (let ((standard-output output-buf))
+       ,@body)
+     (if (with-current-buffer output-buf (< (point-min) (point-max)))
+         (display-buffer output-buf t))))
+(put 'stgit-capture-output 'lisp-indent-function 1)
+
+(defun stgit-run (&rest args)
+  (apply 'call-process "stg" nil standard-output nil args))
+
+(defun stgit-refresh ()
+  "Update the contents of the stgit buffer"
+  (interactive)
+  (let ((inhibit-read-only t)
+        (curline (line-number-at-pos))
+        (curpatch (stgit-patch-at-point)))
+    (erase-buffer)
+    (insert "Branch: ")
+    (stgit-run "branch")
+    (stgit-run "series")
+    (if curpatch
+        (stgit-goto-patch curpatch)
+      (goto-line curline))))
+
+(defvar stgit-mode-hook nil
+  "Run after `stgit-mode' is setup.")
+
+(defvar stgit-mode-map nil
+  "Keymap for StGit major mode.")
+
+(unless stgit-mode-map
+  (setq stgit-mode-map (make-keymap))
+  (suppress-keymap stgit-mode-map)
+  (define-key stgit-mode-map "g"   'stgit-refresh)
+  (define-key stgit-mode-map "r"   'stgit-rename)
+  (define-key stgit-mode-map ">"   'stgit-push-next)
+  (define-key stgit-mode-map "<"   'stgit-pop)
+  (define-key stgit-mode-map "="   'stgit-show))
+
+(defun stgit-mode ()
+  "Major mode for interacting with StGit.
+Commands:
+\\{stgit-mode-map}"
+  (kill-all-local-variables)
+  (buffer-disable-undo)
+  (setq mode-name "StGit"
+        major-mode 'stgit-mode
+        goal-column 2)
+  (use-local-map stgit-mode-map)
+  (set (make-local-variable 'list-buffers-directory) default-directory)
+  (run-hooks 'stgit-mode-hook))
+
+(defun stgit-patch-at-point ()
+  "Return the patch name on the current line"
+  (save-excursion
+    (beginning-of-line)
+    (if (looking-at "[>+-] \\(.*\\)")
+        (match-string 1)
+      nil)))
+
+(defun stgit-goto-patch (patch)
+  "Move point to the line containing PATCH"
+  (let ((p (point)))
+    (goto-char (point-min))
+    (if (re-search-forward (concat "[>+-] " (regexp-quote patch) "$") nil t)
+        (progn (move-to-column goal-column)
+               t)
+      (goto-char p)
+      nil)))
+
+(defun stgit-rename (name)
+  "Rename the patch under point"
+  (interactive (list (read-string "Patch name: " (stgit-patch-at-point))))
+  (let ((old-name (stgit-patch-at-point)))
+    (unless old-name
+      (error "No patch on this line"))
+    (stgit-capture-output nil
+      (stgit-run "rename" old-name name))
+    (stgit-refresh)
+    (stgit-goto-patch name)))
+
+(defun stgit-push-next ()
+  "Push the patch on the line after pos"
+  (interactive)
+  (forward-line 1)
+  (let ((patch (stgit-patch-at-point)))
+    (stgit-capture-output nil
+      (stgit-run "push" patch))
+    (stgit-refresh)))
+
+(defun stgit-pop ()
+  "Pop the patch on the current line"
+  (interactive)
+  (let ((patch (stgit-patch-at-point)))
+    (stgit-capture-output nil
+      (stgit-run "pop" patch))
+    (stgit-refresh)
+    (previous-line)))
+
+(defun stgit-show ()
+  "Show the patch on the current line"
+  (interactive)
+  (stgit-capture-output "*StGit patch*"
+    (stgit-run "show" (stgit-patch-at-point))
+    (with-current-buffer standard-output
+      (goto-char (point-min))
+      (diff-mode))))

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 02/17] Emacs mode: Show keybindings when user presses "h" or "?"
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
  2007-12-14 10:55 ` [StGit PATCH 01/17] Add an StGit mode for emacs David Kågedal
@ 2007-12-14 10:56 ` David Kågedal
  2007-12-14 10:56 ` [StGit PATCH 03/17] Emacs mode: Add an explanatory header David Kågedal
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:56 UTC (permalink / raw
  To: catalin.marinas, git

From: Karl Hasselström <kha@treskal.com>

These are the same keys the git emacs mode uses.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 1bdc0a5..09dec8b 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -65,6 +65,8 @@ Argument DIR is the repository path."
 (unless stgit-mode-map
   (setq stgit-mode-map (make-keymap))
   (suppress-keymap stgit-mode-map)
+  (define-key stgit-mode-map "?"   'stgit-help)
+  (define-key stgit-mode-map "h"   'stgit-help)
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
   (define-key stgit-mode-map ">"   'stgit-push-next)
@@ -139,3 +141,8 @@ Commands:
     (with-current-buffer standard-output
       (goto-char (point-min))
       (diff-mode))))
+
+(defun stgit-help ()
+  "Display help for the StGit mode."
+  (interactive)
+  (describe-function 'stgit-mode))

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 03/17] Emacs mode: Add an explanatory header
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
  2007-12-14 10:55 ` [StGit PATCH 01/17] Add an StGit mode for emacs David Kågedal
  2007-12-14 10:56 ` [StGit PATCH 02/17] Emacs mode: Show keybindings when user presses "h" or "?" David Kågedal
@ 2007-12-14 10:56 ` David Kågedal
  2007-12-14 10:57 ` [StGit PATCH 04/17] Emacs mode: Makefile for building stgit.el David Kågedal
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:56 UTC (permalink / raw
  To: catalin.marinas, git

From: Karl Hasselström <kha@treskal.com>

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 09dec8b..cce0c0e 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -1,3 +1,14 @@
+;; stgit.el: An emacs mode for StGit
+;;
+;; Copyright (C) 2007 David Kågedal <davidk@lysator.liu.se>
+;;
+;; To install: put this file on the load-path and place the following
+;; in your .emacs file:
+;;
+;;    (require 'stgit)
+;;
+;; To start: `M-x stgit'
+
 (defun stgit (dir)
   "Manage stgit patches"
   (interactive "DDirectory: \n")
@@ -146,3 +157,5 @@ Commands:
   "Display help for the StGit mode."
   (interactive)
   (describe-function 'stgit-mode))
+
+(provide 'stgit)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 04/17] Emacs mode: Makefile for building stgit.el
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (2 preceding siblings ...)
  2007-12-14 10:56 ` [StGit PATCH 03/17] Emacs mode: Add an explanatory header David Kågedal
@ 2007-12-14 10:57 ` David Kågedal
  2007-12-14 10:57 ` [StGit PATCH 05/17] Emacs mode: push/pop next patch, not patch at point David Kågedal
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw
  To: catalin.marinas, git

From: Karl Hasselström <kha@treskal.com>

Shamelessly stolen from git's contrib/emacs/Makefile.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/Makefile |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
 create mode 100644 contrib/Makefile


diff --git a/contrib/Makefile b/contrib/Makefile
new file mode 100644
index 0000000..8556910
--- /dev/null
+++ b/contrib/Makefile
@@ -0,0 +1,19 @@
+EMACS = emacs
+
+ELC = stgit.elc
+INSTALL ?= install
+INSTALL_ELC = $(INSTALL) -m 644
+prefix ?= $(HOME)
+emacsdir = $(prefix)/share/emacs/site-lisp
+RM ?= rm -f
+
+all: $(ELC)
+
+install: all
+	$(INSTALL) -d $(DESTDIR)$(emacsdir)
+	$(INSTALL_ELC) $(ELC:.elc=.el) $(ELC) $(DESTDIR)$(emacsdir)
+
+%.elc: %.el
+	$(EMACS) -batch -f batch-byte-compile $<
+
+clean:; $(RM) $(ELC)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 05/17] Emacs mode: push/pop next patch, not patch at point
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (3 preceding siblings ...)
  2007-12-14 10:57 ` [StGit PATCH 04/17] Emacs mode: Makefile for building stgit.el David Kågedal
@ 2007-12-14 10:57 ` David Kågedal
  2007-12-14 10:57 ` [StGit PATCH 06/17] Emacs mode: Let "P" push or pop " David Kågedal
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw
  To: catalin.marinas, git

From: Karl Hasselström <kha@treskal.com>

The three operations we should have are:

  * Pop the topmost applied patch, no matter where point is.

  * Push the first unapplied patch, no matter where point is.

  * Push/pop the patch at point, depending on whether it's currently
    applied.

This patch makes "<" and ">" do the first two operations. The third is
coming in a later patch.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index cce0c0e..17b5d6b 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -81,7 +81,7 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
   (define-key stgit-mode-map ">"   'stgit-push-next)
-  (define-key stgit-mode-map "<"   'stgit-pop)
+  (define-key stgit-mode-map "<"   'stgit-pop-next)
   (define-key stgit-mode-map "="   'stgit-show))
 
 (defun stgit-mode ()
@@ -127,22 +127,16 @@ Commands:
     (stgit-goto-patch name)))
 
 (defun stgit-push-next ()
-  "Push the patch on the line after pos"
+  "Push the first unapplied patch"
   (interactive)
-  (forward-line 1)
-  (let ((patch (stgit-patch-at-point)))
-    (stgit-capture-output nil
-      (stgit-run "push" patch))
-    (stgit-refresh)))
+  (stgit-capture-output nil (stgit-run "push"))
+  (stgit-refresh))
 
-(defun stgit-pop ()
-  "Pop the patch on the current line"
+(defun stgit-pop-next ()
+  "Pop the topmost applied patch"
   (interactive)
-  (let ((patch (stgit-patch-at-point)))
-    (stgit-capture-output nil
-      (stgit-run "pop" patch))
-    (stgit-refresh)
-    (previous-line)))
+  (stgit-capture-output nil (stgit-run "pop"))
+  (stgit-refresh))
 
 (defun stgit-show ()
   "Show the patch on the current line"

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 06/17] Emacs mode: Let "P" push or pop patch at point
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (4 preceding siblings ...)
  2007-12-14 10:57 ` [StGit PATCH 05/17] Emacs mode: push/pop next patch, not patch at point David Kågedal
@ 2007-12-14 10:57 ` David Kågedal
  2007-12-14 10:57 ` [StGit PATCH 07/17] Emacs mode: Bind "G" to "stg goto" David Kågedal
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw
  To: catalin.marinas, git

From: Karl Hasselström <kha@treskal.com>

When the user presses "P", push or pop the patch at point depending on
whether it's applied or unapplied.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 17b5d6b..d371e71 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -82,6 +82,7 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "r"   'stgit-rename)
   (define-key stgit-mode-map ">"   'stgit-push-next)
   (define-key stgit-mode-map "<"   'stgit-pop-next)
+  (define-key stgit-mode-map "P"   'stgit-push-or-pop)
   (define-key stgit-mode-map "="   'stgit-show))
 
 (defun stgit-mode ()
@@ -138,6 +139,21 @@ Commands:
   (stgit-capture-output nil (stgit-run "pop"))
   (stgit-refresh))
 
+(defun stgit-applied-at-point ()
+  "Is the patch on the current line applied?"
+  (save-excursion
+    (beginning-of-line)
+    (looking-at "[>+]")))
+
+(defun stgit-push-or-pop ()
+  "Push or pop the patch on the current line"
+  (interactive)
+  (let ((patch (stgit-patch-at-point))
+        (applied (stgit-applied-at-point)))
+    (stgit-capture-output nil
+       (stgit-run (if applied "pop" "push") patch))
+    (stgit-refresh)))
+
 (defun stgit-show ()
   "Show the patch on the current line"
   (interactive)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 07/17] Emacs mode: Bind "G" to "stg goto"
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (5 preceding siblings ...)
  2007-12-14 10:57 ` [StGit PATCH 06/17] Emacs mode: Let "P" push or pop " David Kågedal
@ 2007-12-14 10:57 ` David Kågedal
  2007-12-14 10:57 ` [StGit PATCH 08/17] Emacs mode: show patches' short description David Kågedal
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw
  To: catalin.marinas, git

From: Karl Hasselström <kha@treskal.com>

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index d371e71..78e9520 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -83,6 +83,7 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map ">"   'stgit-push-next)
   (define-key stgit-mode-map "<"   'stgit-pop-next)
   (define-key stgit-mode-map "P"   'stgit-push-or-pop)
+  (define-key stgit-mode-map "G"   'stgit-goto)
   (define-key stgit-mode-map "="   'stgit-show))
 
 (defun stgit-mode ()
@@ -154,6 +155,14 @@ Commands:
        (stgit-run (if applied "pop" "push") patch))
     (stgit-refresh)))
 
+(defun stgit-goto ()
+  "Go to the patch on the current line"
+  (interactive)
+  (let ((patch (stgit-patch-at-point)))
+    (stgit-capture-output nil
+       (stgit-run "goto" patch))
+    (stgit-refresh)))
+
 (defun stgit-show ()
   "Show the patch on the current line"
   (interactive)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 08/17] Emacs mode: show patches' short description
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (6 preceding siblings ...)
  2007-12-14 10:57 ` [StGit PATCH 07/17] Emacs mode: Bind "G" to "stg goto" David Kågedal
@ 2007-12-14 10:57 ` David Kågedal
  2007-12-14 10:58 ` [StGit PATCH 09/17] Emacs mode: Improve the output buffer state David Kågedal
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw
  To: catalin.marinas, git

From: Karl Hasselström <kha@treskal.com>

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 78e9520..ed2fc37 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -62,7 +62,7 @@ Argument DIR is the repository path."
     (erase-buffer)
     (insert "Branch: ")
     (stgit-run "branch")
-    (stgit-run "series")
+    (stgit-run "series" "--description")
     (if curpatch
         (stgit-goto-patch curpatch)
       (goto-line curline))))
@@ -97,13 +97,14 @@ Commands:
         goal-column 2)
   (use-local-map stgit-mode-map)
   (set (make-local-variable 'list-buffers-directory) default-directory)
+  (set-variable 'truncate-lines 't)
   (run-hooks 'stgit-mode-hook))
 
 (defun stgit-patch-at-point ()
   "Return the patch name on the current line"
   (save-excursion
     (beginning-of-line)
-    (if (looking-at "[>+-] \\(.*\\)")
+    (if (looking-at "[>+-] \\([^ ]*\\)")
         (match-string 1)
       nil)))
 
@@ -111,7 +112,7 @@ Commands:
   "Move point to the line containing PATCH"
   (let ((p (point)))
     (goto-char (point-min))
-    (if (re-search-forward (concat "[>+-] " (regexp-quote patch) "$") nil t)
+    (if (re-search-forward (concat "[>+-] " (regexp-quote patch) " ") nil t)
         (progn (move-to-column goal-column)
                t)
       (goto-char p)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 09/17] Emacs mode: Improve the output buffer state
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (7 preceding siblings ...)
  2007-12-14 10:57 ` [StGit PATCH 08/17] Emacs mode: show patches' short description David Kågedal
@ 2007-12-14 10:58 ` David Kågedal
  2007-12-14 10:58 ` [StGit PATCH 10/17] Emacs mode: Bind n and p David Kågedal
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw
  To: catalin.marinas, git

Make the output buffer have the correct default-directory, and make it
read-only and unmodified.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index ed2fc37..82f0d38 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -41,13 +41,20 @@ Argument DIR is the repository path."
 
 (defmacro stgit-capture-output (name &rest body)
   "Capture StGit output and show it in a window at the end"
-  `(let ((output-buf (get-buffer-create ,(or name "*StGit output*"))))
+  `(let ((output-buf (get-buffer-create ,(or name "*StGit output*")))
+         (stgit-dir default-directory)
+         (inhibit-read-only t))
      (with-current-buffer output-buf
-       (erase-buffer))
+       (erase-buffer)
+       (setq default-directory stgit-dir)
+       (setq buffer-read-only t))
      (let ((standard-output output-buf))
        ,@body)
-     (if (with-current-buffer output-buf (< (point-min) (point-max)))
-         (display-buffer output-buf t))))
+     (with-current-buffer output-buf
+       (set-buffer-modified-p nil)
+       (setq buffer-read-only t)
+       (if (< (point-min) (point-max))
+           (display-buffer output-buf t)))))
 (put 'stgit-capture-output 'lisp-indent-function 1)
 
 (defun stgit-run (&rest args)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 10/17] Emacs mode: Bind n and p
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (8 preceding siblings ...)
  2007-12-14 10:58 ` [StGit PATCH 09/17] Emacs mode: Improve the output buffer state David Kågedal
@ 2007-12-14 10:58 ` David Kågedal
  2007-12-14 10:58 ` [StGit PATCH 11/17] Emacs mode: add stgit-repair David Kågedal
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 82f0d38..2d18061 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -85,6 +85,8 @@ Argument DIR is the repository path."
   (suppress-keymap stgit-mode-map)
   (define-key stgit-mode-map "?"   'stgit-help)
   (define-key stgit-mode-map "h"   'stgit-help)
+  (define-key stgit-mode-map "p"   'previous-line)
+  (define-key stgit-mode-map "n"   'next-line)
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
   (define-key stgit-mode-map ">"   'stgit-push-next)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 11/17] Emacs mode: add stgit-repair
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (9 preceding siblings ...)
  2007-12-14 10:58 ` [StGit PATCH 10/17] Emacs mode: Bind n and p David Kågedal
@ 2007-12-14 10:58 ` David Kågedal
  2007-12-14 10:58 ` [StGit PATCH 12/17] Emacs mode: added stgit-commit and stgit-uncommit David Kågedal
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 2d18061..20cb08f 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -89,6 +89,7 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "n"   'next-line)
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
+  (define-key stgit-mode-map "\C-r"   'stgit-repair)
   (define-key stgit-mode-map ">"   'stgit-push-next)
   (define-key stgit-mode-map "<"   'stgit-pop-next)
   (define-key stgit-mode-map "P"   'stgit-push-or-pop)
@@ -138,6 +139,13 @@ Commands:
     (stgit-refresh)
     (stgit-goto-patch name)))
 
+(defun stgit-repair ()
+  "Run stg repair"
+  (interactive)
+  (stgit-capture-output nil
+   (stgit-run "repair"))
+  (stgit-refresh))
+
 (defun stgit-push-next ()
   "Push the first unapplied patch"
   (interactive)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 12/17] Emacs mode: added stgit-commit and stgit-uncommit
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (10 preceding siblings ...)
  2007-12-14 10:58 ` [StGit PATCH 11/17] Emacs mode: add stgit-repair David Kågedal
@ 2007-12-14 10:58 ` David Kågedal
  2007-12-14 10:59 ` [StGit PATCH 13/17] Emacs mode: Add stgit-edit command David Kågedal
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 20cb08f..4282585 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -90,6 +90,8 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
   (define-key stgit-mode-map "\C-r"   'stgit-repair)
+  (define-key stgit-mode-map "C"   'stgit-commit)
+  (define-key stgit-mode-map "U"   'stgit-uncommit)
   (define-key stgit-mode-map ">"   'stgit-push-next)
   (define-key stgit-mode-map "<"   'stgit-pop-next)
   (define-key stgit-mode-map "P"   'stgit-push-or-pop)
@@ -146,6 +148,18 @@ Commands:
    (stgit-run "repair"))
   (stgit-refresh))
 
+(defun stgit-commit ()
+  "Run stg commit."
+  (interactive)
+  (stgit-capture-output nil (stgit-run "commit"))
+  (stgit-refresh))
+
+(defun stgit-uncommit (arg)
+  "Run stg uncommit. Numeric arg determines number of patches to uncommit."
+  (interactive "p")
+  (stgit-capture-output nil (stgit-run "uncommit" "-n" (number-to-string arg)))
+  (stgit-refresh))
+
 (defun stgit-push-next ()
   "Push the first unapplied patch"
   (interactive)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 13/17] Emacs mode: Add stgit-edit command
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (11 preceding siblings ...)
  2007-12-14 10:58 ` [StGit PATCH 12/17] Emacs mode: added stgit-commit and stgit-uncommit David Kågedal
@ 2007-12-14 10:59 ` David Kågedal
  2007-12-14 10:59 ` [StGit PATCH 14/17] Emacs mode: added fontification David Kågedal
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 4282585..a344869 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -89,6 +89,7 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "n"   'next-line)
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
+  (define-key stgit-mode-map "e"   'stgit-edit)
   (define-key stgit-mode-map "\C-r"   'stgit-repair)
   (define-key stgit-mode-map "C"   'stgit-commit)
   (define-key stgit-mode-map "U"   'stgit-uncommit)
@@ -204,6 +205,30 @@ Commands:
       (goto-char (point-min))
       (diff-mode))))
 
+(defun stgit-edit ()
+  "Edit the patch on the current line"
+  (interactive)
+  (let ((patch (if (stgit-applied-at-point)
+                   (stgit-patch-at-point)
+                 (error "This patch is not applied")))
+        (edit-buf (get-buffer-create "*stgit edit*"))
+        (dir default-directory))
+    (log-edit 'stgit-confirm-edit t nil edit-buf)
+    (set (make-local-variable 'stgit-edit-patch) patch)
+    (setq default-directory dir)
+    (let ((standard-output edit-buf))
+      (stgit-run "edit" "--save-template=-" patch))))
+
+(defun stgit-confirm-edit ()
+  (interactive)
+  (let ((file (make-temp-file "stgit-edit-")))
+    (write-region (point-min) (point-max) file)
+    (stgit-capture-output nil
+      (stgit-run "edit" "-f" file stgit-edit-patch))
+    (with-current-buffer log-edit-parent-buffer
+      (stgit-refresh))))
+
+
 (defun stgit-help ()
   "Display help for the StGit mode."
   (interactive)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 14/17] Emacs mode: added fontification
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (12 preceding siblings ...)
  2007-12-14 10:59 ` [StGit PATCH 13/17] Emacs mode: Add stgit-edit command David Kågedal
@ 2007-12-14 10:59 ` David Kågedal
  2007-12-14 10:59 ` [StGit PATCH 15/17] Emacs mode: Added stgit-new David Kågedal
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index a344869..0859086 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -70,10 +70,52 @@ Argument DIR is the repository path."
     (insert "Branch: ")
     (stgit-run "branch")
     (stgit-run "series" "--description")
+    (stgit-rehighlight (point-min) (point-max))
     (if curpatch
         (stgit-goto-patch curpatch)
       (goto-line curline))))
 
+(defface stgit-description-face
+  '((((background dark)) (:foreground "tan"))
+    (((background light)) (:foreground "dark red")))
+  "The face used for StGit desriptions")
+
+(defface stgit-top-patch-face
+  '((((background dark)) (:weight bold :foreground "yellow"))
+    (((background light)) (:weight bold :foreground "purple"))
+    (t (:weight bold)))
+  "The face used for the top patch names")
+
+(defface stgit-applied-patch-face
+  '((((background dark)) (:foreground "light yellow"))
+    (((background light)) (:foreground "purple"))
+    (t ()))
+  "The face used for applied patch names")
+
+(defface stgit-unapplied-patch-face
+  '((((background dark)) (:foreground "gray80"))
+    (((background light)) (:foreground "orchid"))
+    (t ()))
+  "The face used for unapplied patch names")
+
+(defun stgit-rehighlight (start end)
+  "Refresh fontification of region between START and END."
+  (save-excursion
+    (goto-char start)
+    (while (< (point) end)
+      (cond ((looking-at "Branch: \\(.*\\)")
+             (put-text-property (match-beginning 1) (match-end 1) 'face 'bold))
+            ((looking-at "\\([>+-]\\) \\([^ ]+\\) *| \\(.*\\)")
+             (let ((state (match-string 1)))
+               (put-text-property
+                (match-beginning 2) (match-end 2)
+                'face (cond ((string= state ">") 'stgit-top-patch-face)
+                            ((string= state "+") 'stgit-applied-patch-face)
+                            ((string= state "-") 'stgit-unapplied-patch-face)))
+               (put-text-property (match-beginning 3) (match-end 3)
+                                  'face 'stgit-description-face))))
+      (forward-line 1))))
+
 (defvar stgit-mode-hook nil
   "Run after `stgit-mode' is setup.")
 
@@ -118,7 +160,7 @@ Commands:
   (save-excursion
     (beginning-of-line)
     (if (looking-at "[>+-] \\([^ ]*\\)")
-        (match-string 1)
+        (match-string-no-properties 1)
       nil)))
 
 (defun stgit-goto-patch (patch)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 15/17] Emacs mode: Added stgit-new
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (13 preceding siblings ...)
  2007-12-14 10:59 ` [StGit PATCH 14/17] Emacs mode: added fontification David Kågedal
@ 2007-12-14 10:59 ` David Kågedal
  2007-12-14 10:59 ` [StGit PATCH 16/17] Emacs mode: Add mark command David Kågedal
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 0859086..1cb4dd2 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -132,6 +132,7 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
   (define-key stgit-mode-map "e"   'stgit-edit)
+  (define-key stgit-mode-map "N"   'stgit-new)
   (define-key stgit-mode-map "\C-r"   'stgit-repair)
   (define-key stgit-mode-map "C"   'stgit-commit)
   (define-key stgit-mode-map "U"   'stgit-uncommit)
@@ -270,6 +271,44 @@ Commands:
     (with-current-buffer log-edit-parent-buffer
       (stgit-refresh))))
 
+(defun stgit-new ()
+  "Create a new patch"
+  (interactive)
+  (let ((edit-buf (get-buffer-create "*stgit edit*")))
+    (log-edit 'stgit-confirm-new t nil edit-buf)))
+
+(defun stgit-confirm-new ()
+  (interactive)
+  (let ((file (make-temp-file "stgit-edit-"))
+        (patch (stgit-create-patch-name
+                (buffer-substring (point-min)
+                                  (save-excursion (goto-char (point-min))
+                                                  (end-of-line)
+                                                  (point))))))
+    (write-region (point-min) (point-max) file)
+    (stgit-capture-output nil
+      (stgit-run "new" "-m" "placeholder" patch)
+      (stgit-run "edit" "-f" file patch))
+    (with-current-buffer log-edit-parent-buffer
+      (stgit-refresh))))
+
+(defun stgit-create-patch-name (description)
+  "Create a patch name from a long description"
+  (let ((patch ""))
+    (while (> (length description) 0)
+      (cond ((string-match "\\`[a-zA-Z_-]+" description)
+             (setq patch (downcase (concat patch (match-string 0 description))))
+             (setq description (substring description (match-end 0))))
+            ((string-match "\\` +" description)
+             (setq patch (concat patch "-"))
+             (setq description (substring description (match-end 0))))
+            ((string-match "\\`[^a-zA-Z_-]+" description)
+             (setq description (substring description (match-end 0))))))
+    (cond ((= (length patch) 0)
+           "patch")
+          ((> (length patch) 20)
+           (substring patch 0 20))
+          (t patch))))
 
 (defun stgit-help ()
   "Display help for the StGit mode."

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 16/17] Emacs mode: Add mark command
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (14 preceding siblings ...)
  2007-12-14 10:59 ` [StGit PATCH 15/17] Emacs mode: Added stgit-new David Kågedal
@ 2007-12-14 10:59 ` David Kågedal
  2007-12-14 10:59 ` [StGit PATCH 17/17] Emacs mode: coalesce command David Kågedal
  2007-12-17 11:09 ` [StGit PATCH 00/17] Series short description Catalin Marinas
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   76 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 57 insertions(+), 19 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index 1cb4dd2..dfbf4a0 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -70,7 +70,7 @@ Argument DIR is the repository path."
     (insert "Branch: ")
     (stgit-run "branch")
     (stgit-run "series" "--description")
-    (stgit-rehighlight (point-min) (point-max))
+    (stgit-rescan)
     (if curpatch
         (stgit-goto-patch curpatch)
       (goto-line curline))))
@@ -98,23 +98,30 @@ Argument DIR is the repository path."
     (t ()))
   "The face used for unapplied patch names")
 
-(defun stgit-rehighlight (start end)
-  "Refresh fontification of region between START and END."
+(defun stgit-rescan ()
+  "Rescan the status buffer."
   (save-excursion
-    (goto-char start)
-    (while (< (point) end)
-      (cond ((looking-at "Branch: \\(.*\\)")
-             (put-text-property (match-beginning 1) (match-end 1) 'face 'bold))
-            ((looking-at "\\([>+-]\\) \\([^ ]+\\) *| \\(.*\\)")
-             (let ((state (match-string 1)))
-               (put-text-property
-                (match-beginning 2) (match-end 2)
-                'face (cond ((string= state ">") 'stgit-top-patch-face)
-                            ((string= state "+") 'stgit-applied-patch-face)
-                            ((string= state "-") 'stgit-unapplied-patch-face)))
-               (put-text-property (match-beginning 3) (match-end 3)
-                                  'face 'stgit-description-face))))
-      (forward-line 1))))
+    (let ((marked ()))
+      (goto-char (point-min))
+      (while (not (eobp))
+        (cond ((looking-at "Branch: \\(.*\\)")
+               (put-text-property (match-beginning 1) (match-end 1)
+                                  'face 'bold))
+              ((looking-at "\\([>+-]\\)\\( \\)\\([^ ]+\\) *| \\(.*\\)")
+               (let ((state (match-string 1))
+                     (patchsym (intern (match-string 3))))
+                 (put-text-property
+                  (match-beginning 3) (match-end 3) 'face
+                  (cond ((string= state ">") 'stgit-top-patch-face)
+                        ((string= state "+") 'stgit-applied-patch-face)
+                        ((string= state "-") 'stgit-unapplied-patch-face)))
+                 (put-text-property (match-beginning 4) (match-end 4)
+                                    'face 'stgit-description-face)
+                 (when (memq patchsym stgit-marked-patches)
+                   (replace-match "*" nil nil nil 2)
+                   (setq marked (cons patchsym marked))))))
+        (forward-line 1))
+      (setq stgit-marked-patches (nreverse marked)))))
 
 (defvar stgit-mode-hook nil
   "Run after `stgit-mode' is setup.")
@@ -125,6 +132,8 @@ Argument DIR is the repository path."
 (unless stgit-mode-map
   (setq stgit-mode-map (make-keymap))
   (suppress-keymap stgit-mode-map)
+  (define-key stgit-mode-map " "   'stgit-mark)
+  (define-key stgit-mode-map "\d" 'stgit-unmark)
   (define-key stgit-mode-map "?"   'stgit-help)
   (define-key stgit-mode-map "h"   'stgit-help)
   (define-key stgit-mode-map "p"   'previous-line)
@@ -153,14 +162,27 @@ Commands:
         goal-column 2)
   (use-local-map stgit-mode-map)
   (set (make-local-variable 'list-buffers-directory) default-directory)
+  (set (make-local-variable 'stgit-marked-patches) nil)
   (set-variable 'truncate-lines 't)
   (run-hooks 'stgit-mode-hook))
 
+(defun stgit-add-mark (patch)
+  (let ((patchsym (intern patch)))
+    (setq stgit-marked-patches (cons patchsym stgit-marked-patches))))
+
+(defun stgit-remove-mark (patch)
+  (let ((patchsym (intern patch)))
+    (setq stgit-marked-patches (delq patchsym stgit-marked-patches))))
+
+(defun stgit-marked-patches ()
+  "Return the names of the marked patches."
+  (mapcar 'symbol-name stgit-marked-patches))
+
 (defun stgit-patch-at-point ()
   "Return the patch name on the current line"
   (save-excursion
     (beginning-of-line)
-    (if (looking-at "[>+-] \\([^ ]*\\)")
+    (if (looking-at "[>+-][ *]\\([^ ]*\\)")
         (match-string-no-properties 1)
       nil)))
 
@@ -168,12 +190,28 @@ Commands:
   "Move point to the line containing PATCH"
   (let ((p (point)))
     (goto-char (point-min))
-    (if (re-search-forward (concat "[>+-] " (regexp-quote patch) " ") nil t)
+    (if (re-search-forward (concat "^[>+-][ *]" (regexp-quote patch) " ") nil t)
         (progn (move-to-column goal-column)
                t)
       (goto-char p)
       nil)))
 
+(defun stgit-mark ()
+  "Mark the patch under point"
+  (interactive)
+  (let ((patch (stgit-patch-at-point)))
+    (stgit-add-mark patch)
+    (stgit-refresh))
+  (next-line))
+
+(defun stgit-unmark ()
+  "Mark the patch on the previous line"
+  (interactive)
+  (forward-line -1)
+  (let ((patch (stgit-patch-at-point)))
+    (stgit-remove-mark patch)
+    (stgit-refresh)))
+
 (defun stgit-rename (name)
   "Rename the patch under point"
   (interactive (list (read-string "Patch name: " (stgit-patch-at-point))))

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 17/17] Emacs mode: coalesce command
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (15 preceding siblings ...)
  2007-12-14 10:59 ` [StGit PATCH 16/17] Emacs mode: Add mark command David Kågedal
@ 2007-12-14 10:59 ` David Kågedal
  2007-12-17 11:09 ` [StGit PATCH 00/17] Series short description Catalin Marinas
  17 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw
  To: catalin.marinas, git


Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 contrib/stgit.el |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)


diff --git a/contrib/stgit.el b/contrib/stgit.el
index dfbf4a0..4d0faca 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -141,6 +141,7 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "g"   'stgit-refresh)
   (define-key stgit-mode-map "r"   'stgit-rename)
   (define-key stgit-mode-map "e"   'stgit-edit)
+  (define-key stgit-mode-map "c"   'stgit-coalesce)
   (define-key stgit-mode-map "N"   'stgit-new)
   (define-key stgit-mode-map "\C-r"   'stgit-repair)
   (define-key stgit-mode-map "C"   'stgit-commit)
@@ -348,6 +349,26 @@ Commands:
            (substring patch 0 20))
           (t patch))))
 
+(defun stgit-coalesce (patch-names)
+  "Run stg coalesce on the named patches"
+  (interactive (list (stgit-marked-patches)))
+  (let ((edit-buf (get-buffer-create "*stgit edit*"))
+        (dir default-directory))
+    (log-edit 'stgit-confirm-coalesce t nil edit-buf)
+    (set (make-local-variable 'stgit-patches) patch-names)
+    (setq default-directory dir)
+    (let ((standard-output edit-buf))
+      (apply 'stgit-run "coalesce" "--save-template=-" patch-names))))
+
+(defun stgit-confirm-coalesce ()
+  (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-patches))
+    (with-current-buffer log-edit-parent-buffer
+      (stgit-refresh))))
+
 (defun stgit-help ()
   "Display help for the StGit mode."
   (interactive)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* Re: [StGit PATCH 00/17] Series short description
  2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
                   ` (16 preceding siblings ...)
  2007-12-14 10:59 ` [StGit PATCH 17/17] Emacs mode: coalesce command David Kågedal
@ 2007-12-17 11:09 ` Catalin Marinas
  2007-12-17 22:48   ` Karl Hasselström
  17 siblings, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-17 11:09 UTC (permalink / raw
  To: David Kågedal; +Cc: git

On 14/12/2007, David Kågedal <davidk@lysator.liu.se> wrote:
> The following series an emacs interface to stgit patch stacks. It
> shows a buffer with the the output of "stg series" and allows you to
> do some common operations on it, such as push/pop, commit/uncommit,
> edit, rename, repair, and coalesce.

That's really cool stuff! Thanks.

> The coalesce command obviosly requires the kha/experimental branch.
> The edit command requires the edit fixes in kha/safe.

I'll start this week merging patches from kha/experimental (I'm a bit
slow because of the Christmas activities).

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [StGit PATCH 00/17] Series short description
  2007-12-17 11:09 ` [StGit PATCH 00/17] Series short description Catalin Marinas
@ 2007-12-17 22:48   ` Karl Hasselström
  2007-12-18  5:21     ` kha/safe and kha/experimental updated Karl Hasselström
  2007-12-18  9:11     ` [StGit PATCH 00/17] Series short description Catalin Marinas
  0 siblings, 2 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-17 22:48 UTC (permalink / raw
  To: Catalin Marinas; +Cc: David Kågedal, git

On 2007-12-17 11:09:06 +0000, Catalin Marinas wrote:

> On 14/12/2007, David Kågedal <davidk@lysator.liu.se> wrote:
>
> > The following series an emacs interface to stgit patch stacks. It
> > shows a buffer with the the output of "stg series" and allows you
> > to do some common operations on it, such as push/pop,
> > commit/uncommit, edit, rename, repair, and coalesce.
>
> That's really cool stuff! Thanks.

Yes, incredibly useful.

I've put this series in kha/safe -- except for the mark and coalesce
patches, which are at the tip of kha/experimental. The latter because
it obviously has to be, the former because the latter is the only
thing using it and it's _extremely annoying_ to be able to mark
patches but not, say, push or pop all marked patches.

My stack is now 53 patches deep, so running the test suite on every
patch is getting time consuming -- I'd guess about two hours on my
poor laptop. And I plan to sleep while that runs, so I won't actually
push this until tomorrow.

> > The coalesce command obviosly requires the kha/experimental
> > branch. The edit command requires the edit fixes in kha/safe.
>
> I'll start this week merging patches from kha/experimental (I'm a
> bit slow because of the Christmas activities).

Be careful about merging past the "goto" patch -- I'm pretty sure it
breaks when called from a subdirectory, and I don't have time to fix
that right now. (It should be a clean fix, though -- just adjust the
cwd for precisely those git subprocesses that need it, which is very
few. I think.)

If you like, I can advance "safe" to include as many patches as I
think you should merge right now.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* kha/safe and kha/experimental updated
  2007-12-17 22:48   ` Karl Hasselström
@ 2007-12-18  5:21     ` Karl Hasselström
  2007-12-18 16:09       ` Catalin Marinas
  2007-12-19 14:59       ` Catalin Marinas
  2007-12-18  9:11     ` [StGit PATCH 00/17] Series short description Catalin Marinas
  1 sibling, 2 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-18  5:21 UTC (permalink / raw
  To: Catalin Marinas; +Cc: David Kågedal, git

On 2007-12-17 23:48:12 +0100, Karl Hasselström wrote:

> If you like, I can advance "safe" to include as many patches as I
> think you should merge right now.

And here it is:

The following changes since commit 5be69cd8d89bd89be31364e9c0fd9e947b6ef644:
  Karl Hasselström (1):
        Name the exit codes to improve legibility

are available in the git repository at:

  git://repo.or.cz/stgit/kha.git safe

David Kågedal (17):
      Add an StGit mode for emacs
      Emacs mode: Improve the output buffer state
      Emacs mode: Bind n and p
      Emacs mode: add stgit-repair
      Emacs mode: added stgit-commit and stgit-uncommit
      Emacs mode: Add stgit-edit command
      Emacs mode: added fontification
      Emacs mode: Added stgit-new
      Check bottom and invariants
      Remove the 'bottom' field
      Remove the 'top' field
      Split git.merge into two functions
      Leave working dir and index alone after failed (conflicting) push
      Added a test case to check what happens when push finds a conflict
      Simplify merge_recursive
      Use the output from merge-recursive to list conflicts
      Ask git about unmerged files

Karl Hasselström (24):
      Emacs mode: Show keybindings when user presses "h" or "?"
      Emacs mode: Add an explanatory header
      Emacs mode: Makefile for building stgit.el
      Emacs mode: push/pop next patch, not patch at point
      Emacs mode: Let "P" push or pop patch at point
      Emacs mode: Bind "G" to "stg goto"
      Emacs mode: show patches' short description
      Write removed fields for backwards compatibility
      Nicer conflict markers
      Better error message if merge fails
      Fix "stg resolved" to work with new conflict representation
      Refactoring: pass more than one file to resolved()
      We keep the different stages of a conflict in the index now
      "stg status --reset" is not needed anymore
      Remove "stg add"
      Remove "stg rm"
      Remove "stg cp"
      Remove "stg resolved"
      New StGit core infrastructure: repository operations
      Write metadata files used by the old infrastructure
      Upgrade older stacks to newest version
      Let "stg clean" use the new infrastructure
      Add "stg coalesce"
      Let "stg applied" and "stg unapplied" use the new infrastructure

 Documentation/stg-cp.txt      |   63 --------
 Documentation/stg.txt         |    2 -
 Documentation/tutorial.txt    |   31 +++--
 contrib/Makefile              |   19 +++
 contrib/stgit-completion.bash |    4 +-
 contrib/stgit.el              |  318 +++++++++++++++++++++++++++++++++++++++++
 examples/gitconfig            |   19 +---
 setup.py                      |    2 +-
 stgit/commands/add.py         |   44 ------
 stgit/commands/applied.py     |   27 ++--
 stgit/commands/clean.py       |   68 +++++-----
 stgit/commands/coalesce.py    |   84 +++++++++++
 stgit/commands/common.py      |   39 +++---
 stgit/commands/copy.py        |   45 ------
 stgit/commands/pick.py        |    2 +-
 stgit/commands/resolved.py    |   94 ------------
 stgit/commands/rm.py          |   48 ------
 stgit/commands/status.py      |   31 ++---
 stgit/commands/sync.py        |    1 -
 stgit/commands/unapplied.py   |   23 ++--
 stgit/config.py               |    1 -
 stgit/git.py                  |   75 ++++++----
 stgit/gitmergeonefile.py      |   97 +------------
 stgit/lib/__init__.py         |   18 +++
 stgit/lib/git.py              |  260 +++++++++++++++++++++++++++++++++
 stgit/lib/stack.py            |  172 ++++++++++++++++++++++
 stgit/lib/stackupgrade.py     |   96 ++++++++++++
 stgit/lib/transaction.py      |   79 ++++++++++
 stgit/main.py                 |   10 +-
 stgit/run.py                  |    3 +
 stgit/stack.py                |  156 ++++----------------
 stgit/utils.py                |   24 +++
 t/t0002-status.sh             |   15 +-
 t/t1200-push-modified.sh      |    2 +-
 t/t1202-push-undo.sh          |    6 +-
 t/t1203-push-conflict.sh      |   70 +++++++++
 t/t1204-pop-keep.sh           |    2 +-
 t/t1205-push-subdir.sh        |    8 +-
 t/t1300-uncommit.sh           |    4 +-
 t/t1301-repair.sh             |    2 +-
 t/t1400-patch-history.sh      |    4 +-
 t/t1500-float.sh              |   14 +-
 t/t1600-delete-one.sh         |   12 +-
 t/t1601-delete-many.sh        |    2 +-
 t/t1700-goto-top.sh           |    2 +-
 t/t2000-sync.sh               |   12 +-
 t/t2100-pull-policy-fetch.sh  |    4 +-
 t/t2101-pull-policy-pull.sh   |    4 +-
 t/t2102-pull-policy-rebase.sh |    4 +-
 t/t2300-refresh-subdir.sh     |    2 +-
 t/t2600-coalesce.sh           |   31 ++++
 51 files changed, 1420 insertions(+), 735 deletions(-)
 delete mode 100644 Documentation/stg-cp.txt
 create mode 100644 contrib/Makefile
 create mode 100644 contrib/stgit.el
 delete mode 100644 stgit/commands/add.py
 create mode 100644 stgit/commands/coalesce.py
 delete mode 100644 stgit/commands/copy.py
 delete mode 100644 stgit/commands/resolved.py
 delete mode 100644 stgit/commands/rm.py
 create mode 100644 stgit/lib/__init__.py
 create mode 100644 stgit/lib/git.py
 create mode 100644 stgit/lib/stack.py
 create mode 100644 stgit/lib/stackupgrade.py
 create mode 100644 stgit/lib/transaction.py
 create mode 100755 t/t1203-push-conflict.sh
 create mode 100755 t/t2600-coalesce.sh

                                 -+-

The following changes since commit 1189271615e7157ca3da3288a9ce3c9bcaeb2d5f:
  Karl Hasselström (1):
        Let "stg applied" and "stg unapplied" use the new infrastructure

are available in the git repository at:

  git://repo.or.cz/stgit/kha.git experimental

David Kågedal (2):
      Emacs mode: Add mark command
      Emacs mode: coalesce command

Karl Hasselström (10):
      Teach the new infrastructure about the index and worktree
      Let "stg clean" use the new transaction primitives
      Let "stg goto" use the new infrastructure
      Convert "stg uncommit" to the new infrastructure
      New infrastructure: Make sure that the branch is initialized
      Expose transaction abort function
      stg coalesce: Support --file and --save-template
      Set exit code to 3 on merge conflict
      Convert "stg commit" to new infrastructure
      Make "stg commit" fancier

 contrib/stgit.el           |   97 +++++++++++++++++++-----
 stgit/commands/clean.py    |   35 ++-------
 stgit/commands/coalesce.py |  118 +++++++++++++++++++----------
 stgit/commands/commit.py   |  111 +++++++++++++++++----------
 stgit/commands/goto.py     |   52 +++++---------
 stgit/commands/uncommit.py |   81 +++++++++-----------
 stgit/lib/git.py           |  127 +++++++++++++++++++++++++++++++
 stgit/lib/stack.py         |   10 ++-
 stgit/lib/stackupgrade.py  |    6 +-
 stgit/lib/transaction.py   |  178 ++++++++++++++++++++++++++++++++++++++------
 stgit/main.py              |    4 +-
 stgit/utils.py             |    1 +
 t/t1300-uncommit.sh        |   12 ++--
 13 files changed, 588 insertions(+), 244 deletions(-)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [StGit PATCH 00/17] Series short description
  2007-12-17 22:48   ` Karl Hasselström
  2007-12-18  5:21     ` kha/safe and kha/experimental updated Karl Hasselström
@ 2007-12-18  9:11     ` Catalin Marinas
  2007-12-18  9:20       ` David Kågedal
  2007-12-18  9:24       ` Karl Hasselström
  1 sibling, 2 replies; 57+ messages in thread
From: Catalin Marinas @ 2007-12-18  9:11 UTC (permalink / raw
  To: Karl Hasselström; +Cc: David Kågedal, git

On 17/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> On 2007-12-17 11:09:06 +0000, Catalin Marinas wrote:
>
> > On 14/12/2007, David Kågedal <davidk@lysator.liu.se> wrote:
> >
> > > The following series an emacs interface to stgit patch stacks. It
> > > shows a buffer with the the output of "stg series" and allows you
> > > to do some common operations on it, such as push/pop,
> > > commit/uncommit, edit, rename, repair, and coalesce.
> >
> > That's really cool stuff! Thanks.
>
> Yes, incredibly useful.

Other useful commands would be support for 'patches' and a local
diff/status (and maybe a menu).

> Be careful about merging past the "goto" patch -- I'm pretty sure it
> breaks when called from a subdirectory, and I don't have time to fix
> that right now. (It should be a clean fix, though -- just adjust the
> cwd for precisely those git subprocesses that need it, which is very
> few. I think.)

Why not just change the cwd when the command starts and it should be
safe for all the git subprocesses.

> If you like, I can advance "safe" to include as many patches as I
> think you should merge right now.

OK, thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [StGit PATCH 00/17] Series short description
  2007-12-18  9:11     ` [StGit PATCH 00/17] Series short description Catalin Marinas
@ 2007-12-18  9:20       ` David Kågedal
  2007-12-18  9:24       ` Karl Hasselström
  1 sibling, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-18  9:20 UTC (permalink / raw
  To: Karl Hasselström, Catalin Marinas; +Cc: git

"Catalin Marinas" <catalin.marinas@gmail.com> writes:

> On 17/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>> On 2007-12-17 11:09:06 +0000, Catalin Marinas wrote:
>>
>> > On 14/12/2007, David Kågedal <davidk@lysator.liu.se> wrote:
>> >
>> > > The following series an emacs interface to stgit patch stacks. It
>> > > shows a buffer with the the output of "stg series" and allows you
>> > > to do some common operations on it, such as push/pop,
>> > > commit/uncommit, edit, rename, repair, and coalesce.
>> >
>> > That's really cool stuff! Thanks.
>>
>> Yes, incredibly useful.
>
> Other useful commands would be support for 'patches' and a local
> diff/status (and maybe a menu).

I have some ideas for some way of showing the current status, but
nothing is implemented yet. For some of the more complex cases, I'd
like to refer to git.el, although I think that needs some
improvements.

I don't think I ever used the 'patches' command, so I'm not sure what
the best way to implement it would be.

And my emacs has no menu, so I'm probably not the best person to adda
menu, either :-)

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [StGit PATCH 00/17] Series short description
  2007-12-18  9:11     ` [StGit PATCH 00/17] Series short description Catalin Marinas
  2007-12-18  9:20       ` David Kågedal
@ 2007-12-18  9:24       ` Karl Hasselström
  2007-12-19 22:19         ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström
  1 sibling, 1 reply; 57+ messages in thread
From: Karl Hasselström @ 2007-12-18  9:24 UTC (permalink / raw
  To: Catalin Marinas; +Cc: David Kågedal, git

On 2007-12-18 09:11:00 +0000, Catalin Marinas wrote:

> On 17/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>
> > Be careful about merging past the "goto" patch -- I'm pretty sure
> > it breaks when called from a subdirectory, and I don't have time
> > to fix that right now. (It should be a clean fix, though -- just
> > adjust the cwd for precisely those git subprocesses that need it,
> > which is very few. I think.)
>
> Why not just change the cwd when the command starts and it should be
> safe for all the git subprocesses.

It doesn't feel very clean to require the caller of some unspecified
subset of git calls to remember to set the correct piece of global
state.

And the correct solution should really be very simple, since it's
precisely the worktree operations (specifically, the subset thereof
that have to operate on the whole tree) that require setting cwd. And
those are very clearly separated out from the rest in the new
infrastructure.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18  5:21     ` kha/safe and kha/experimental updated Karl Hasselström
@ 2007-12-18 16:09       ` Catalin Marinas
  2007-12-18 16:39         ` Jakub Narebski
                           ` (2 more replies)
  2007-12-19 14:59       ` Catalin Marinas
  1 sibling, 3 replies; 57+ messages in thread
From: Catalin Marinas @ 2007-12-18 16:09 UTC (permalink / raw
  To: Karl Hasselström; +Cc: David Kågedal, git

Thanks again for maintaining these branches.

On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>   git://repo.or.cz/stgit/kha.git safe
>
> David Kågedal (17):
[...]
>       Simplify merge_recursive
>       Use the output from merge-recursive to list conflicts

I'll drop git.merge() entirely since it is only used by the 'sync'
command due to the performance issues I had in the past with rename
detection in git-merge-recursive. Hopefully, these are gone now.

I'll try to fix the automatic invocation of the interactive merger in
case of conflicts (it is only present in git.merge()).

> Karl Hasselström (24):
>       Fix "stg resolved" to work with new conflict representation

For some reason, the interactive resolving keeps invoking the merger.
I'll have a look.

>       "stg status --reset" is not needed anymore

I would keep this as an alias for 'git reset --hard' (see below as well).

>       Remove "stg add"
>       Remove "stg rm"
>       Remove "stg cp"

I plan to add a generic command for these kind of aliases. The reason
is that I don't really like mixing GIT and StGIT commands (I think at
some point I'll get confused and try to run stg commands with git).

>       Remove "stg resolved"

I'd like to keep this command. git-mergetool doesn't support the tool
I use (emacs + ediff and more stgit-specific file extensions like
current, patch etc.). I also don't find 'git add' to be meaningful for
marking a conflict as solved.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18 16:09       ` Catalin Marinas
@ 2007-12-18 16:39         ` Jakub Narebski
  2007-12-18 16:52           ` Catalin Marinas
  2007-12-19  9:38           ` Karl Hasselström
  2007-12-19  9:34         ` Karl Hasselström
  2007-12-19 15:38         ` Catalin Marinas
  2 siblings, 2 replies; 57+ messages in thread
From: Jakub Narebski @ 2007-12-18 16:39 UTC (permalink / raw
  To: Catalin Marinas; +Cc: Karl Hasselström, David Kågedal, git

"Catalin Marinas" <catalin.marinas@gmail.com> writes:

> Thanks again for maintaining these branches.
> 
> On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> >   git://repo.or.cz/stgit/kha.git safe

> >       Remove "stg resolved"
> 
> I'd like to keep this command. git-mergetool doesn't support the tool
> I use (emacs + ediff and more stgit-specific file extensions like
> current, patch etc.). I also don't find 'git add' to be meaningful for
> marking a conflict as solved.

I also would like to have this command kept (and shown in 'stg help'!).
Contrary to 'git add' it can check and add to index / update index
only for files with conflict; we have -r (ancestor|current|patched)
to choose one side, and we could add --check to check if there are
no conflict markers with files (useful with -a/--all).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18 16:39         ` Jakub Narebski
@ 2007-12-18 16:52           ` Catalin Marinas
  2007-12-19  9:41             ` David Kågedal
  2007-12-19  9:38           ` Karl Hasselström
  1 sibling, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-18 16:52 UTC (permalink / raw
  To: Jakub Narebski; +Cc: Karl Hasselström, David Kågedal, git

On 18/12/2007, Jakub Narebski <jnareb@gmail.com> wrote:
> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>
> > Thanks again for maintaining these branches.
> >
> > On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> > >   git://repo.or.cz/stgit/kha.git safe
>
> > >       Remove "stg resolved"
> >
> > I'd like to keep this command. git-mergetool doesn't support the tool
> > I use (emacs + ediff and more stgit-specific file extensions like
> > current, patch etc.). I also don't find 'git add' to be meaningful for
> > marking a conflict as solved.
>
> I also would like to have this command kept (and shown in 'stg help'!).
> Contrary to 'git add' it can check and add to index / update index
> only for files with conflict; we have -r (ancestor|current|patched)
> to choose one side, and we could add --check to check if there are
> no conflict markers with files (useful with -a/--all).

I'd also like to re-add the stgit.keeporig option and additional
functionality so that the *.{ancestor,current,patched} can be left in
the working tree. Some people might use them when manually fixing
conflicts (I have a look at them from time to time when the emacs +
ediff shows a hard to understand conflict).

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18 16:09       ` Catalin Marinas
  2007-12-18 16:39         ` Jakub Narebski
@ 2007-12-19  9:34         ` Karl Hasselström
  2007-12-19 10:09           ` Catalin Marinas
  2007-12-19 15:38         ` Catalin Marinas
  2 siblings, 1 reply; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19  9:34 UTC (permalink / raw
  To: Catalin Marinas; +Cc: David Kågedal, git

On 2007-12-18 16:09:24 +0000, Catalin Marinas wrote:

> On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>
> >       "stg status --reset" is not needed anymore
>
> I would keep this as an alias for 'git reset --hard' (see below as
> well).
>
> >       Remove "stg add"
> >       Remove "stg rm"
> >       Remove "stg cp"
>
> I plan to add a generic command for these kind of aliases. The
> reason is that I don't really like mixing GIT and StGIT commands (I
> think at some point I'll get confused and try to run stg commands
> with git).

How should these aliases be presented in the documentation etc.? I
suggest making it very clear that they are only aliases.

> >       Remove "stg resolved"
>
> I'd like to keep this command. git-mergetool doesn't support the
> tool I use (emacs + ediff and more stgit-specific file extensions
> like current, patch etc.).

So why have a separate command instead of fixing git-mergetool?

> I also don't find 'git add' to be meaningful for marking a conflict
> as solved.

So maybe let "stg resolved" be an alias for "git add"?

This is all our usual disagreement: You want stg to be a fairly
standalone tool, and I want it to be a tool to use side by side with
git. The problem I see with your approach is that stg risks ending up
like Cogito: it'll provide inspiration for improving git, but will
itself become obsolete because of the simple fact that git has so much
more development manpower. I think it'd be more productive to let stg
do one thing -- patch stacks -- and do it well, and rely on git for
everything else.

Of course, if stuff like "stg add" and "stg resolved" are really
implemented as three-line wrappers around git commands, we don't have
that problem.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18 16:39         ` Jakub Narebski
  2007-12-18 16:52           ` Catalin Marinas
@ 2007-12-19  9:38           ` Karl Hasselström
  2007-12-19 10:44             ` Jakub Narebski
  1 sibling, 1 reply; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19  9:38 UTC (permalink / raw
  To: Jakub Narebski; +Cc: Catalin Marinas, David Kågedal, git

On 2007-12-18 08:39:52 -0800, Jakub Narebski wrote:

> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>
> > On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> >
> > >       Remove "stg resolved"
> >
> > I'd like to keep this command. git-mergetool doesn't support the
> > tool I use (emacs + ediff and more stgit-specific file extensions
> > like current, patch etc.). I also don't find 'git add' to be
> > meaningful for marking a conflict as solved.
>
> I also would like to have this command kept (and shown in 'stg
> help'!). Contrary to 'git add' it can check and add to index /
> update index only for files with conflict; we have -r
> (ancestor|current|patched) to choose one side, and we could add
> --check to check if there are no conflict markers with files (useful
> with -a/--all).

This too sounds like stuff that could profitably be added to "git
add". Except for the ancestor/current/patched words, it is not
specific to patch stacks, so the implementation should be in git and
not in stg.

IMHO, of course. :-)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18 16:52           ` Catalin Marinas
@ 2007-12-19  9:41             ` David Kågedal
  2007-12-19  9:50               ` David Kågedal
  2007-12-19 10:19               ` Catalin Marinas
  0 siblings, 2 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-19  9:41 UTC (permalink / raw
  To: Jakub Narebski, Catalin Marinas; +Cc: git, Karl Hasselström

"Catalin Marinas" <catalin.marinas@gmail.com> writes:

> On 18/12/2007, Jakub Narebski <jnareb@gmail.com> wrote:
>> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>>
>> > Thanks again for maintaining these branches.
>> >
>> > On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>> > >   git://repo.or.cz/stgit/kha.git safe
>>
>> > >       Remove "stg resolved"
>> >
>> > I'd like to keep this command. git-mergetool doesn't support the tool
>> > I use (emacs + ediff and more stgit-specific file extensions like
>> > current, patch etc.). I also don't find 'git add' to be meaningful for
>> > marking a conflict as solved.
>>
>> I also would like to have this command kept (and shown in 'stg help'!).
>> Contrary to 'git add' it can check and add to index / update index
>> only for files with conflict; we have -r (ancestor|current|patched)
>> to choose one side, and we could add --check to check if there are
>> no conflict markers with files (useful with -a/--all).
>
> I'd also like to re-add the stgit.keeporig option and additional
> functionality so that the *.{ancestor,current,patched} can be left in
> the working tree. Some people might use them when manually fixing
> conflicts (I have a look at them from time to time when the emacs +
> ediff shows a hard to understand conflict).

Since all the information is in git, it is of course easy to recreate
it. But the important question to ask is: how do you use these extra
files? git.el provides a way to diff against both parent versions, and
maybe that is actually what you need.

I don't mind that you want these files, but they are mostly clutter to
me.

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19  9:41             ` David Kågedal
@ 2007-12-19  9:50               ` David Kågedal
  2007-12-19 10:19               ` Catalin Marinas
  1 sibling, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-19  9:50 UTC (permalink / raw
  To: Catalin Marinas, Jakub Narebski; +Cc: Karl Hasselström, git

David Kågedal <davidk@lysator.liu.se> writes:

> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>
>> On 18/12/2007, Jakub Narebski <jnareb@gmail.com> wrote:
>>> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>>>
>>> > Thanks again for maintaining these branches.
>>> >
>>> > On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>>> > >   git://repo.or.cz/stgit/kha.git safe
>>>
>>> > >       Remove "stg resolved"
>>> >
>>> > I'd like to keep this command. git-mergetool doesn't support the tool
>>> > I use (emacs + ediff and more stgit-specific file extensions like
>>> > current, patch etc.). I also don't find 'git add' to be meaningful for
>>> > marking a conflict as solved.
>>>
>>> I also would like to have this command kept (and shown in 'stg help'!).
>>> Contrary to 'git add' it can check and add to index / update index
>>> only for files with conflict; we have -r (ancestor|current|patched)
>>> to choose one side, and we could add --check to check if there are
>>> no conflict markers with files (useful with -a/--all).
>>
>> I'd also like to re-add the stgit.keeporig option and additional
>> functionality so that the *.{ancestor,current,patched} can be left in
>> the working tree. Some people might use them when manually fixing
>> conflicts (I have a look at them from time to time when the emacs +
>> ediff shows a hard to understand conflict).
>
> Since all the information is in git, it is of course easy to recreate
> it. But the important question to ask is: how do you use these extra
> files? git.el provides a way to diff against both parent versions, and
> maybe that is actually what you need.

Note that I'm talking about the kha/experimental branch here. The
point of my patches there are to make sure that the git index is left
in the unmerged state so that normal git tools can be used.  This
means that git diff-files -2 and -3 does what you want.

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19  9:34         ` Karl Hasselström
@ 2007-12-19 10:09           ` Catalin Marinas
  2007-12-19 11:20             ` Karl Hasselström
  0 siblings, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 10:09 UTC (permalink / raw
  To: Karl Hasselström; +Cc: David Kågedal, git

On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> On 2007-12-18 16:09:24 +0000, Catalin Marinas wrote:
>
> > On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> >
> > >       "stg status --reset" is not needed anymore
> >
> > I would keep this as an alias for 'git reset --hard' (see below as
> > well).
> >
> > >       Remove "stg add"
> > >       Remove "stg rm"
> > >       Remove "stg cp"
> >
> > I plan to add a generic command for these kind of aliases. The
> > reason is that I don't really like mixing GIT and StGIT commands (I
> > think at some point I'll get confused and try to run stg commands
> > with git).
>
> How should these aliases be presented in the documentation etc.? I
> suggest making it very clear that they are only aliases.

Yes, 'stg help' should clearly mark them as aliases of git commands.
I'm not sure how I'll do this yet. For the 'status --reset', I'll keep
it if we have a separate 'resolved' command.

> > >       Remove "stg resolved"
> >
> > I'd like to keep this command. git-mergetool doesn't support the
> > tool I use (emacs + ediff and more stgit-specific file extensions
> > like current, patch etc.).
>
> So why have a separate command instead of fixing git-mergetool?

In the past, StGIT only used the core git functionality and stayed
away from the porcelain scripts. We now started to use some of the
built-in commands more and more and I think it is fine but the git
scripts look more volatile to me than the C code (look at the many
variants the git merging went through, from shell scripts to python
and only now seems to be stabilised with the recursive merge as a
built-in command).

Adding the functionality I need to git-mergetool would also mean
always using the latest GIT with StGIT. Anyway, if you like
git-mergetool, I think you can easily change the StGIT configuration
to

> > I also don't find 'git add' to be meaningful for marking a conflict
> > as solved.
>
> So maybe let "stg resolved" be an alias for "git add"?

It's not a simple alias, if you use 'stg resolved -a'. Now, if we
allow stgit.keeporig, it needs even more functionality.

> This is all our usual disagreement: You want stg to be a fairly
> standalone tool, and I want it to be a tool to use side by side with
> git. The problem I see with your approach is that stg risks ending up
> like Cogito: it'll provide inspiration for improving git, but will
> itself become obsolete because of the simple fact that git has so much
> more development manpower.

If GIT would have all the functionality I need for my workflow, I
wouldn't mind giving up StGIT (I started StGIT because I needed easier
patch management on top of GIT and modifying Quilt would've been too
intrusive).

> I think it'd be more productive to let stg
> do one thing -- patch stacks -- and do it well, and rely on git for
> everything else.

In principle, yes, but I have some minor problems with the UI of GIT
(like resolved == add). I think there is also a fundamental difference
between 'git commit' and 'stg refresh'. The former requires explicit
marking of the files to commit (or use the -a option) while the latter
always adds all the local changes to the current patch. Maybe GIT
users are more used to running 'git add' after fixing a conflict but I
use StGIT almost exclusively.

> Of course, if stuff like "stg add" and "stg resolved" are really
> implemented as three-line wrappers around git commands, we don't have
> that problem.

For add/rm/cp, they should just be a generic wrapper which doesn't
even parse the command line options. That's not the case with
'resolved'.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19  9:41             ` David Kågedal
  2007-12-19  9:50               ` David Kågedal
@ 2007-12-19 10:19               ` Catalin Marinas
  1 sibling, 0 replies; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 10:19 UTC (permalink / raw
  To: David Kågedal; +Cc: Jakub Narebski, git, Karl Hasselström

On 19/12/2007, David Kågedal <davidk@lysator.liu.se> wrote:
> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
> > I'd also like to re-add the stgit.keeporig option and additional
> > functionality so that the *.{ancestor,current,patched} can be left in
> > the working tree. Some people might use them when manually fixing
> > conflicts (I have a look at them from time to time when the emacs +
> > ediff shows a hard to understand conflict).
>
> Since all the information is in git, it is of course easy to recreate
> it. But the important question to ask is: how do you use these extra
> files? git.el provides a way to diff against both parent versions, and
> maybe that is actually what you need.
>
> I don't mind that you want these files, but they are mostly clutter to
> me.

You can set stgit.keeporig to 'no' if you don't want these files.

For people not using emacs + git.el, the files might be useful. As you
said, you could use 'git diff -2/-3' but, in various occasions I just
wanted to copy a block of code from one of the checked-out stages.
Without this feature, I would have to use plain git and remember what
stage corresponds to my patch.

Note that there are other users (apart from me) that use StGIT almost
exclusively. I really don't like forcing them to use more and more
plain git commands (at some point, they might even discover 'git
rebase -i' to be good enough and give up on StGIT :-)).

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19  9:38           ` Karl Hasselström
@ 2007-12-19 10:44             ` Jakub Narebski
  2007-12-19 11:40               ` Karl Hasselström
  0 siblings, 1 reply; 57+ messages in thread
From: Jakub Narebski @ 2007-12-19 10:44 UTC (permalink / raw
  To: Karl Hasselström; +Cc: Catalin Marinas, David Kågedal, git

On Wed, 19 Dec 2007, Karl Hasselström wrote:
> On 2007-12-18 08:39:52 -0800, Jakub Narebski wrote:
> > "Catalin Marinas" <catalin.marinas@gmail.com> writes:
> >
> > > On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> > >
> > > >       Remove "stg resolved"
> > >
> > > I'd like to keep this command. git-mergetool doesn't support the
> > > tool I use (emacs + ediff and more stgit-specific file extensions
> > > like current, patch etc.). I also don't find 'git add' to be
> > > meaningful for marking a conflict as solved.
> >
> > I also would like to have this command kept (and shown in 'stg
> > help'!). Contrary to 'git add' it can check and add to index /
> > update index only for files with conflict; we have -r
> > (ancestor|current|patched) to choose one side, and we could add
> > --check to check if there are no conflict markers with files (useful
> > with -a/--all).
> 
> This too sounds like stuff that could profitably be added to "git
> add". Except for the ancestor/current/patched words, it is not
> specific to patch stacks, so the implementation should be in git and
> not in stg.

No it cannot, at least the '-r (ancestor|current|patched)' part for
resetting file to given version, even if we change the wording to
ancestor, ours and theirs. The git-add command is about adding contents, 
which updates index, which almost as a intended side-effect clears 
merge state, i.e. stages; and not about resetting to stage.

Besides with "stg resolved" you can update index _only_ for files
which were in the conflict, also for -a/--all, and not all the files
not only those which were in the conflict like "git add -u" does.

"stg resolved --check" could happily ignore things that only look
like conflict markers, but must have been intended, because they are
in files not in conflict.


Unless you are talking about adding "resolve"/"resolved" command
to git-core, as a porcelain wrapper around git-update-index, like
"git add"...


P.S. I have just noticed that 'git-checkout' [<tree-ish>] <paths>...
form of operation is not documented; you can derive what it do
only from examples.

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 10:09           ` Catalin Marinas
@ 2007-12-19 11:20             ` Karl Hasselström
  2007-12-19 11:40               ` Catalin Marinas
  0 siblings, 1 reply; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 11:20 UTC (permalink / raw
  To: Catalin Marinas; +Cc: David Kågedal, git

On 2007-12-19 10:09:40 +0000, Catalin Marinas wrote:

> For the 'status --reset', I'll keep it if we have a separate
> 'resolved' command.

?

> In the past, StGIT only used the core git functionality and stayed
> away from the porcelain scripts. We now started to use some of the
> built-in commands more and more and I think it is fine but the git
> scripts look more volatile to me than the C code (look at the many
> variants the git merging went through, from shell scripts to python
> and only now seems to be stabilised with the recursive merge as a
> built-in command).

Hmm? Have we started to use more porcelain lately?

> Adding the functionality I need to git-mergetool would also mean
> always using the latest GIT with StGIT.

It wouldn't keep being the latest git version, though.

> Anyway, if you like git-mergetool, I think you can easily change the
> StGIT configuration to

I don't use interactive merging at all. What I wanted was to get rid
of StGit's own interactive merging.

> On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>
> > On 2007-12-18 16:09:24 +0000, Catalin Marinas wrote:
> >
> > > I also don't find 'git add' to be meaningful for marking a
> > > conflict as solved.
> >
> > So maybe let "stg resolved" be an alias for "git add"?
>
> It's not a simple alias, if you use 'stg resolved -a'. Now, if we
> allow stgit.keeporig, it needs even more functionality.

Hmm, yes.

(I still don't quite like it, because I think that if there's anything
that "stg resolved" does that "git add" can't do, then "git add"
should learn to do it. But until it has learned it, it's a
hypothetical argument.)

> > I think it'd be more productive to let stg do one thing -- patch
> > stacks -- and do it well, and rely on git for everything else.
>
> In principle, yes, but I have some minor problems with the UI of GIT
> (like resolved == add). I think there is also a fundamental
> difference between 'git commit' and 'stg refresh'. The former
> requires explicit marking of the files to commit (or use the -a
> option) while the latter always adds all the local changes to the
> current patch. Maybe GIT users are more used to running 'git add'
> after fixing a conflict but I use StGIT almost exclusively.

So you want StGit to do two things: patch stacks, and fix some git UI
warts. Hey, I can live with that. :-) But I firmly believe that the
wart fixing parts of StGit should be (1) optional, so that the same
job can easily be done with just git; and (2) as thin as possible, to
make them easy to explain in terms of git, and cheap to maintain.

> > Of course, if stuff like "stg add" and "stg resolved" are really
> > implemented as three-line wrappers around git commands, we don't
> > have that problem.
>
> For add/rm/cp, they should just be a generic wrapper which doesn't
> even parse the command line options.

OK.

> That's not the case with 'resolved'.

No, I see.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 10:44             ` Jakub Narebski
@ 2007-12-19 11:40               ` Karl Hasselström
  2007-12-19 11:47                 ` Catalin Marinas
  2007-12-19 16:23                 ` Jakub Narebski
  0 siblings, 2 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 11:40 UTC (permalink / raw
  To: Jakub Narebski; +Cc: Catalin Marinas, David Kågedal, git

On 2007-12-19 11:44:57 +0100, Jakub Narebski wrote:

> On Wed, 19 Dec 2007, Karl Hasselström wrote:
>
> > On 2007-12-18 08:39:52 -0800, Jakub Narebski wrote:
> >
> > > I also would like to have this command kept (and shown in 'stg
> > > help'!). Contrary to 'git add' it can check and add to index /
> > > update index only for files with conflict; we have -r
> > > (ancestor|current|patched) to choose one side, and we could add
> > > --check to check if there are no conflict markers with files
> > > (useful with -a/--all).
> >
> > This too sounds like stuff that could profitably be added to "git
> > add". Except for the ancestor/current/patched words, it is not
> > specific to patch stacks, so the implementation should be in git
> > and not in stg.
>
> No it cannot, at least the '-r (ancestor|current|patched)' part for
> resetting file to given version, even if we change the wording to
> ancestor, ours and theirs. The git-add command is about adding
> contents, which updates index, which almost as a intended
> side-effect clears merge state, i.e. stages; and not about resetting
> to stage.

  git checkout-index --stage=1|2|3 <filename>

does what you want. But "git cat-file" knows this handy syntax for
getting at particular index stages:

  :stage:<filename>

It would be very convenient to be able to do

  git checkout :stage:<filename>

but it doesn't seem to work currently. Does anyone know the "best" way
of manually checking out a particular index stage in git?

> Besides with "stg resolved" you can update index _only_ for files
> which were in the conflict, also for -a/--all, and not all the files
> not only those which were in the conflict like "git add -u" does.

This sounds like a straightforward addition to "git add".

> "stg resolved --check" could happily ignore things that only look
> like conflict markers, but must have been intended, because they are
> in files not in conflict.

git knows about conflicting files too.

> Unless you are talking about adding "resolve"/"resolved" command to
> git-core, as a porcelain wrapper around git-update-index, like "git
> add"...

Yes, that's what I want. You and others like what "stg resolved" does,
but I don't want it in StGit because it's a generic git enhancement
that has nothing to with patch stacks. People who don't use StGit
would presumably like it as well.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 11:20             ` Karl Hasselström
@ 2007-12-19 11:40               ` Catalin Marinas
  2007-12-19 12:10                 ` Karl Hasselström
  0 siblings, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 11:40 UTC (permalink / raw
  To: Karl Hasselström; +Cc: David Kågedal, git

On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> On 2007-12-19 10:09:40 +0000, Catalin Marinas wrote:
>
> > For the 'status --reset', I'll keep it if we have a separate
> > 'resolved' command.
>
> ?

It needs to call the resolved_all to remove checked-out stages if
stgit.keeporig == 'yes'. Maybe it could also do some sanity check if
HEAD != top. With 'git reset --hard', people might easily add an
argument and break the whole stack.

> > In the past, StGIT only used the core git functionality and stayed
> > away from the porcelain scripts. We now started to use some of the
> > built-in commands more and more and I think it is fine but the git
> > scripts look more volatile to me than the C code (look at the many
> > variants the git merging went through, from shell scripts to python
> > and only now seems to be stabilised with the recursive merge as a
> > built-in command).
>
> Hmm? Have we started to use more porcelain lately?

I think Yann was complaining about using git-show since it looks more
like a porcelain command.

> > Adding the functionality I need to git-mergetool would also mean
> > always using the latest GIT with StGIT.
>
> It wouldn't keep being the latest git version, though.

Yes, but at least initially it should be pretty recent.

> > Anyway, if you like git-mergetool, I think you can easily change the
> > StGIT configuration to
>
> I don't use interactive merging at all. What I wanted was to get rid
> of StGit's own interactive merging.

I use it quite often and I even invoke it automatically
(stgit.autoimerge). I'll push some patches tonight together with most
of your safe branch and we can alter them afterwards.

> So you want StGit to do two things: patch stacks, and fix some git UI
> warts. Hey, I can live with that. :-) But I firmly believe that the
> wart fixing parts of StGit should be (1) optional, so that the same
> job can easily be done with just git; and (2) as thin as possible, to
> make them easy to explain in terms of git, and cheap to maintain.

Unless you need the keeporig functionality, you can now always use
plain git for solving merges, add/rm/cp, 'reset --hard' etc. At some
point, we could make it safe for 'git rebase' but I think we need the
DAG patches.

> > That's not the case with 'resolved'.
>
> No, I see.

As I said, if you don't need keeporig, just use git-add (or stg-add
when I'll add the alias).

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 11:40               ` Karl Hasselström
@ 2007-12-19 11:47                 ` Catalin Marinas
  2007-12-19 16:23                 ` Jakub Narebski
  1 sibling, 0 replies; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 11:47 UTC (permalink / raw
  To: Karl Hasselström; +Cc: Jakub Narebski, David Kågedal, git

On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> You and others like what "stg resolved" does,
> but I don't want it in StGit because it's a generic git enhancement
> that has nothing to with patch stacks. People who don't use StGit
> would presumably like it as well.

The --reset option would never be added to git, at least not with the
same name for arguments since git doesn't manage patches. As I said, I
would have to remember what stage my 'patched' file is in.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 11:40               ` Catalin Marinas
@ 2007-12-19 12:10                 ` Karl Hasselström
  0 siblings, 0 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 12:10 UTC (permalink / raw
  To: Catalin Marinas; +Cc: David Kågedal, git

On 2007-12-19 11:40:41 +0000, Catalin Marinas wrote:

> On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>
> > On 2007-12-19 10:09:40 +0000, Catalin Marinas wrote:
> >
> > > For the 'status --reset', I'll keep it if we have a separate
> > > 'resolved' command.
> >
> > ?
>
> It needs to call the resolved_all to remove checked-out stages if
> stgit.keeporig == 'yes'.

Ah, right.

> Maybe it could also do some sanity check if HEAD != top. With 'git
> reset --hard', people might easily add an argument and break the
> whole stack.

True.

> > Hmm? Have we started to use more porcelain lately?
>
> I think Yann was complaining about using git-show since it looks
> more like a porcelain command.

We should probably use cat-file or something instead.

> > It wouldn't keep being the latest git version, though.
>
> Yes, but at least initially it should be pretty recent.

:-)

> > I don't use interactive merging at all. What I wanted was to get
> > rid of StGit's own interactive merging.
>
> I use it quite often and I even invoke it automatically
> (stgit.autoimerge). I'll push some patches tonight together with
> most of your safe branch and we can alter them afterwards.

Jolly good! My stack was getting unwieldy ...

> > So you want StGit to do two things: patch stacks, and fix some git
> > UI warts. Hey, I can live with that. :-) But I firmly believe that
> > the wart fixing parts of StGit should be (1) optional, so that the
> > same job can easily be done with just git; and (2) as thin as
> > possible, to make them easy to explain in terms of git, and cheap
> > to maintain.
>
> Unless you need the keeporig functionality, you can now always use
> plain git for solving merges, add/rm/cp, 'reset --hard' etc.

Yes, with David's conflict series.

> At some point, we could make it safe for 'git rebase' but I think we
> need the DAG patches.

I wouldn't resurrect the DAG patches for this; I'd just invoke "stg
repair" automatically when we detect that top != HEAD.

But I think that for "git rebase", we'd want to teach "repair" to
detect that the patches' commits have been changed, rather than just
marking them unapplied.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18  5:21     ` kha/safe and kha/experimental updated Karl Hasselström
  2007-12-18 16:09       ` Catalin Marinas
@ 2007-12-19 14:59       ` Catalin Marinas
  2007-12-19 15:39         ` David Kågedal
  1 sibling, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 14:59 UTC (permalink / raw
  To: Karl Hasselström; +Cc: David Kågedal, git

On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>   git://repo.or.cz/stgit/kha.git safe
[...]
>       Ask git about unmerged files

This patch wrongly assumes that there is a stage 2 entry in the index.
Test t1202-push-undo.sh fails because a file is added, differently, in
both master and patch but it doesn't exist in ancestor (no stage 2).
Using stage 3 doesn't fix it either because a patch might remove a
file.

I fixed it by using a set to get the unique names.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-18 16:09       ` Catalin Marinas
  2007-12-18 16:39         ` Jakub Narebski
  2007-12-19  9:34         ` Karl Hasselström
@ 2007-12-19 15:38         ` Catalin Marinas
  2 siblings, 0 replies; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 15:38 UTC (permalink / raw
  To: Karl Hasselström; +Cc: David Kågedal, git

On 18/12/2007, Catalin Marinas <catalin.marinas@gmail.com> wrote:
> On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> >       Fix "stg resolved" to work with new conflict representation
>
> For some reason, the interactive resolving keeps invoking the merger.
> I'll have a look.

I found the problem. git.ls_files() now returns all three stages if
there was a conflict and the file list got longer. I added a set to
remove the duplicates.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 14:59       ` Catalin Marinas
@ 2007-12-19 15:39         ` David Kågedal
  0 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-19 15:39 UTC (permalink / raw
  To: Karl Hasselström, Catalin Marinas; +Cc: git

"Catalin Marinas" <catalin.marinas@gmail.com> writes:

> On 18/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>>   git://repo.or.cz/stgit/kha.git safe
> [...]
>>       Ask git about unmerged files
>
> This patch wrongly assumes that there is a stage 2 entry in the index.
> Test t1202-push-undo.sh fails because a file is added, differently, in
> both master and patch but it doesn't exist in ancestor (no stage 2).
> Using stage 3 doesn't fix it either because a patch might remove a
> file.
>
> I fixed it by using a set to get the unique names.

That sounds reasonable.

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 11:40               ` Karl Hasselström
  2007-12-19 11:47                 ` Catalin Marinas
@ 2007-12-19 16:23                 ` Jakub Narebski
  2007-12-19 17:02                   ` Catalin Marinas
  2007-12-19 17:14                   ` Karl Hasselström
  1 sibling, 2 replies; 57+ messages in thread
From: Jakub Narebski @ 2007-12-19 16:23 UTC (permalink / raw
  To: Karl Hasselström
  Cc: Catalin Marinas, David Kågedal, git, Theodore Ts'o

Karl Hasselström wrote:
> On 2007-12-19 11:44:57 +0100, Jakub Narebski wrote:
>> On Wed, 19 Dec 2007, Karl Hasselström wrote:
>>> On 2007-12-18 08:39:52 -0800, Jakub Narebski wrote:
>>>
>>>> I also would like to have this command kept (and shown in 'stg
>>>> help'!). Contrary to 'git add' it can check and add to index /
>>>> update index only for files with conflict; we have -r
>>>> (ancestor|current|patched) to choose one side, and we could add
>>>> --check to check if there are no conflict markers with files
>>>> (useful with -a/--all).
>>>
>>> This too sounds like stuff that could profitably be added to "git
>>> add". Except for the ancestor/current/patched words, it is not
>>> specific to patch stacks, so the implementation should be in git
>>> and not in stg.
>>
>> No it cannot, at least the '-r (ancestor|current|patched)' part for
>> resetting file to given version, even if we change the wording to
>> ancestor, ours and theirs. The git-add command is about adding
>> contents, which updates index, which almost as a intended
>> side-effect clears merge state, i.e. stages; and not about resetting
>> to stage.
> 
>   git checkout-index --stage=1|2|3 <filename>
> 
> does what you want. But "git cat-file" knows this handy syntax for
> getting at particular index stages:
> 
>   :stage:<filename>

I always forget which stage is which. It would be nice if 
git-checkout-index implemented human-friendly names, just like 
git-diff-files has --base, --ours, --theirs, i.e. if it would be 
possible to write

  git checkout-index --stage=base|ours|theirs <filename>

and perhaps even

  :base|ours|theirs:<filename>.

(but there is a problem with files containing ':'...).

> It would be very convenient to be able to do
> 
>   git checkout :stage:<filename>
> 
> but it doesn't seem to work currently. Does anyone know the "best" way
> of manually checking out a particular index stage in git?

It's a pity it doesn't work. Or if not this, then perhaps

  git checkout --stage=ours -- <filename>

>> Besides with "stg resolved" you can update index _only_ for files
>> which were in the conflict, also for -a/--all, and not all the files
>> not only those which were in the conflict like "git add -u" does.
> 
> This sounds like a straightforward addition to "git add".
> 
>> "stg resolved --check" could happily ignore things that only look
>> like conflict markers, but must have been intended, because they are
>> in files not in conflict.
> 
> git knows about conflicting files too.
> 
>> Unless you are talking about adding "resolve"/"resolved" command to
>> git-core, as a porcelain wrapper around git-update-index, like "git
>> add"...
> 
> Yes, that's what I want. You and others like what "stg resolved" does,
> but I don't want it in StGit because it's a generic git enhancement
> that has nothing to with patch stacks. People who don't use StGit
> would presumably like it as well.

You mean adding another option to git-add, similar to '-u' option, but
updating only the files which were (are) in merge conflict; 
'-c'/'-r'/'-s' perhaps? This would be replacement for 
"stg resolved --all", wouldn't it (and with filename replacement for 
"stg resolved <filename>", of course)?


P.S. Sidenote: it would be nice if git-mergetool was updated to 
understand StGIT style interactive 2-way and 3-way merge configuration,
and not offer only limited choice of pre-defined interactive merge tools 
(although pre-defined are nice, too).

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 16:23                 ` Jakub Narebski
@ 2007-12-19 17:02                   ` Catalin Marinas
  2007-12-19 17:14                     ` David Kågedal
  2007-12-19 17:14                   ` Karl Hasselström
  1 sibling, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 17:02 UTC (permalink / raw
  To: Jakub Narebski
  Cc: Karl Hasselström, David Kågedal, git, Theodore Ts'o

On 19/12/2007, Jakub Narebski <jnareb@gmail.com> wrote:
> Karl Hasselström wrote:
> > On 2007-12-19 11:44:57 +0100, Jakub Narebski wrote:
> >> On Wed, 19 Dec 2007, Karl Hasselström wrote:
> >>> On 2007-12-18 08:39:52 -0800, Jakub Narebski wrote:
> >>>
> >>>> I also would like to have this command kept (and shown in 'stg
> >>>> help'!). Contrary to 'git add' it can check and add to index /
> >>>> update index only for files with conflict; we have -r
> >>>> (ancestor|current|patched) to choose one side, and we could add
> >>>> --check to check if there are no conflict markers with files
> >>>> (useful with -a/--all).
> >>>
> >>> This too sounds like stuff that could profitably be added to "git
> >>> add". Except for the ancestor/current/patched words, it is not
> >>> specific to patch stacks, so the implementation should be in git
> >>> and not in stg.
> >>
> >> No it cannot, at least the '-r (ancestor|current|patched)' part for
> >> resetting file to given version, even if we change the wording to
> >> ancestor, ours and theirs. The git-add command is about adding
> >> contents, which updates index, which almost as a intended
> >> side-effect clears merge state, i.e. stages; and not about resetting
> >> to stage.
> >
> >   git checkout-index --stage=1|2|3 <filename>
> >
> > does what you want. But "git cat-file" knows this handy syntax for
> > getting at particular index stages:
> >
> >   :stage:<filename>
>
> I always forget which stage is which. It would be nice if
> git-checkout-index implemented human-friendly names, just like
> git-diff-files has --base, --ours, --theirs, i.e. if it would be
> possible to write
>
>   git checkout-index --stage=base|ours|theirs <filename>

This gets even more confusing with StGIT. For plain git, after a git
merge or pull conflict, 'theirs' is stage 3. With StGIT, we first
advance the base of the stack and merge the patches onto it, in which
case the 'patched' (which I would normally call 'ours' rather than
'theirs') is 3.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 17:02                   ` Catalin Marinas
@ 2007-12-19 17:14                     ` David Kågedal
  0 siblings, 0 replies; 57+ messages in thread
From: David Kågedal @ 2007-12-19 17:14 UTC (permalink / raw
  To: Jakub Narebski, Catalin Marinas
  Cc: Theodore Ts'o, git, Karl Hasselström

"Catalin Marinas" <catalin.marinas@gmail.com> writes:

>> I always forget which stage is which. It would be nice if
>> git-checkout-index implemented human-friendly names, just like
>> git-diff-files has --base, --ours, --theirs, i.e. if it would be
>> possible to write
>>
>>   git checkout-index --stage=base|ours|theirs <filename>
>
> This gets even more confusing with StGIT. For plain git, after a git
> merge or pull conflict, 'theirs' is stage 3. With StGIT, we first
> advance the base of the stack and merge the patches onto it, in which
> case the 'patched' (which I would normally call 'ours' rather than
> 'theirs') is 3.

True. And the same problem obviously exists for "git rebase".

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe and kha/experimental updated
  2007-12-19 16:23                 ` Jakub Narebski
  2007-12-19 17:02                   ` Catalin Marinas
@ 2007-12-19 17:14                   ` Karl Hasselström
  1 sibling, 0 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 17:14 UTC (permalink / raw
  To: Jakub Narebski
  Cc: Catalin Marinas, David Kågedal, git, Theodore Ts'o

On 2007-12-19 17:23:27 +0100, Jakub Narebski wrote:

> Karl Hasselström wrote:
>
> >   git checkout-index --stage=1|2|3 <filename>
> >
> > does what you want. But "git cat-file" knows this handy syntax for
> > getting at particular index stages:
> >
> >   :stage:<filename>
>
> I always forget which stage is which. It would be nice if
> git-checkout-index implemented human-friendly names, just like
> git-diff-files has --base, --ours, --theirs, i.e. if it would be
> possible to write
>
>   git checkout-index --stage=base|ours|theirs <filename>
>
> and perhaps even
>
>   :base|ours|theirs:<filename>.
>
> (but there is a problem with files containing ':'...).

<ref>:<path> is already accepted, so I don't think this would be much
worse.

And yes, I agree that the base/ours/theirs aliases are nice, and
should be accepted by at least the porcelain commands.

> > Yes, that's what I want. You and others like what "stg resolved"
> > does, but I don't want it in StGit because it's a generic git
> > enhancement that has nothing to with patch stacks. People who
> > don't use StGit would presumably like it as well.
>
> You mean adding another option to git-add, similar to '-u' option,
> but updating only the files which were (are) in merge conflict;
> '-c'/'-r'/'-s' perhaps?

Yes. That _is_ the operation you want, isn't it?

> This would be replacement for "stg resolved --all", wouldn't it (and
> with filename replacement for "stg resolved <filename>", of course)?

Yes. Though with a filename argument, you wouldn't need the new flag.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [StGit PATCH 0/2] Make new infrastructure subdirectory safe
  2007-12-18  9:24       ` Karl Hasselström
@ 2007-12-19 22:19         ` Karl Hasselström
  2007-12-19 22:19           ` [StGit PATCH 1/2] Test that "stg goto" can be called from a subdirectory Karl Hasselström
                             ` (2 more replies)
  0 siblings, 3 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 22:19 UTC (permalink / raw
  To: Catalin Marinas; +Cc: git, David Kågedal

---

Karl Hasselström (2):
      Make "stg goto" subdirectory safe
      Test that "stg goto" can be called from a subdirectory


 stgit/lib/git.py       |    5 ++--
 stgit/run.py           |    9 +++++--
 t/t2800-goto-subdir.sh |   59 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 5 deletions(-)
 create mode 100755 t/t2800-goto-subdir.sh

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [StGit PATCH 1/2] Test that "stg goto" can be called from a subdirectory
  2007-12-19 22:19         ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström
@ 2007-12-19 22:19           ` Karl Hasselström
  2007-12-19 22:24           ` [StGit PATCH 2/2] Make "stg goto" subdirectory safe Karl Hasselström
  2007-12-19 22:28           ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström
  2 siblings, 0 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 22:19 UTC (permalink / raw
  To: Catalin Marinas; +Cc: git, David Kågedal

It currently can't; therefore, the tests are marked as known failures.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 t/t2800-goto-subdir.sh |   59 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100755 t/t2800-goto-subdir.sh


diff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh
new file mode 100755
index 0000000..9f3ab26
--- /dev/null
+++ b/t/t2800-goto-subdir.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+test_description='Run "stg goto" in a subdirectory'
+
+. ./test-lib.sh
+
+test_expect_success 'Initialize StGit stack' '
+    stg init &&
+    echo expected1.txt >> .git/info/exclude &&
+    echo expected2.txt >> .git/info/exclude &&
+    echo actual.txt >> .git/info/exclude &&
+    mkdir foo &&
+    for i in 1 2 3; do
+        echo foo$i >> foo/bar &&
+        stg new p$i -m p$i &&
+        git add foo/bar &&
+        stg refresh
+    done
+'
+
+cat > expected1.txt <<EOF
+foo1
+EOF
+cat > expected2.txt <<EOF
+bar
+EOF
+test_expect_failure 'Goto in subdirectory (just pop)' '
+    (cd foo && stg goto p1) &&
+    cat foo/bar > actual.txt &&
+    diff -u expected1.txt actual.txt &&
+    ls foo > actual.txt &&
+    diff -u expected2.txt actual.txt
+'
+
+test_expect_success 'Prepare conflicting goto' '
+    stg delete p2
+'
+
+cat > expected1.txt <<EOF
+foo1
+<<<<<<< current:foo/bar
+=======
+foo2
+foo3
+>>>>>>> patched:foo/bar
+EOF
+cat > expected2.txt <<EOF
+bar
+EOF
+test_expect_failure 'Goto in subdirectory (conflicting push)' '
+    (cd foo && stg goto p3) ;
+    [ $? -eq 3 ] &&
+    cat foo/bar > actual.txt &&
+    diff -u expected1.txt actual.txt &&
+    ls foo > actual.txt &&
+    diff -u expected2.txt actual.txt
+'
+
+test_done

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [StGit PATCH 2/2] Make "stg goto" subdirectory safe
  2007-12-19 22:19         ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström
  2007-12-19 22:19           ` [StGit PATCH 1/2] Test that "stg goto" can be called from a subdirectory Karl Hasselström
@ 2007-12-19 22:24           ` Karl Hasselström
  2007-12-19 22:46             ` kha/safe updated Karl Hasselström
  2007-12-19 22:28           ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström
  2 siblings, 1 reply; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 22:24 UTC (permalink / raw
  To: Catalin Marinas; +Cc: git, David Kågedal

This is not specific to "stg goto" -- it affects all commands that use
the new infrastructure. (But of those, only goto and coalesce were
subdirectory unsafe.)

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

On 2007-12-18 10:24:19 +0100, Karl Hasselström wrote:

> On 2007-12-18 09:11:00 +0000, Catalin Marinas wrote:
> 
> > On 17/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> >
> > > Be careful about merging past the "goto" patch -- I'm pretty
> > > sure it breaks when called from a subdirectory, and I don't have
> > > time to fix that right now. (It should be a clean fix, though --
> > > just adjust the cwd for precisely those git subprocesses that
> > > need it, which is very few. I think.)
> >
> > Why not just change the cwd when the command starts and it should
> > be safe for all the git subprocesses.
> 
> It doesn't feel very clean to require the caller of some unspecified
> subset of git calls to remember to set the correct piece of global
> state.
> 
> And the correct solution should really be very simple, since it's
> precisely the worktree operations (specifically, the subset thereof
> that have to operate on the whole tree) that require setting cwd.
> And those are very clearly separated out from the rest in the new
> infrastructure.

And here it is! Note that not counting the cwd support in run.py and
changing the test to expect success, I had to change just three lines
to fix this problem for _all_ "new infrastructure" commands. And no
unintended side effects, since the cwd is changed only where it's
necessary.

 stgit/lib/git.py       |    5 +++--
 stgit/run.py           |    9 ++++++---
 t/t2800-goto-subdir.sh |    4 ++--
 3 files changed, 11 insertions(+), 7 deletions(-)


diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 6aba966..118c9b2 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -344,6 +344,7 @@ class Worktree(object):
     def __init__(self, directory):
         self.__directory = directory
     env = property(lambda self: { 'GIT_WORK_TREE': self.__directory })
+    directory = property(lambda self: self.__directory)
 
 class CheckoutException(exception.StgException):
     pass
@@ -364,7 +365,7 @@ class IndexAndWorktree(RunWithEnv):
             self.run(['git', 'read-tree', '-u', '-m',
                       '--exclude-per-directory=.gitignore',
                       old_tree.sha1, new_tree.sha1]
-                     ).discard_output()
+                     ).cwd(self.__worktree.directory).discard_output()
         except run.RunException:
             raise CheckoutException('Index/workdir dirty')
     def merge(self, base, ours, theirs):
@@ -377,7 +378,7 @@ class IndexAndWorktree(RunWithEnv):
                      env = { 'GITHEAD_%s' % base.sha1: 'ancestor',
                              'GITHEAD_%s' % ours.sha1: 'current',
                              'GITHEAD_%s' % theirs.sha1: 'patched'}
-                     ).discard_output()
+                     ).cwd(self.__worktree.directory).discard_output()
         except run.RunException, e:
             raise MergeException('Index/worktree dirty')
     def changed_files(self):
diff --git a/stgit/run.py b/stgit/run.py
index 78537db..77f2e65 100644
--- a/stgit/run.py
+++ b/stgit/run.py
@@ -42,7 +42,7 @@ class Run:
             if type(c) != str:
                 raise Exception, 'Bad command: %r' % (cmd,)
         self.__good_retvals = [0]
-        self.__env = None
+        self.__env = self.__cwd = None
         self.__indata = None
         self.__discard_stderr = False
     def __log_start(self):
@@ -67,7 +67,7 @@ class Run:
         """Run with captured IO."""
         self.__log_start()
         try:
-            p = subprocess.Popen(self.__cmd, env = self.__env,
+            p = subprocess.Popen(self.__cmd, env = self.__env, cwd = self.__cwd,
                                  stdin = subprocess.PIPE,
                                  stdout = subprocess.PIPE,
                                  stderr = subprocess.PIPE)
@@ -85,7 +85,7 @@ class Run:
         assert self.__indata == None
         self.__log_start()
         try:
-            p = subprocess.Popen(self.__cmd, env = self.__env)
+            p = subprocess.Popen(self.__cmd, env = self.__env, cwd = self.__cwd)
             self.exitcode = p.wait()
         except OSError, e:
             raise self.exc('%s failed: %s' % (self.__cmd[0], e))
@@ -104,6 +104,9 @@ class Run:
         self.__env = dict(os.environ)
         self.__env.update(env)
         return self
+    def cwd(self, cwd):
+        self.__cwd = cwd
+        return self
     def raw_input(self, indata):
         self.__indata = indata
         return self
diff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh
index 9f3ab26..fcad7da 100755
--- a/t/t2800-goto-subdir.sh
+++ b/t/t2800-goto-subdir.sh
@@ -24,7 +24,7 @@ EOF
 cat > expected2.txt <<EOF
 bar
 EOF
-test_expect_failure 'Goto in subdirectory (just pop)' '
+test_expect_success 'Goto in subdirectory (just pop)' '
     (cd foo && stg goto p1) &&
     cat foo/bar > actual.txt &&
     diff -u expected1.txt actual.txt &&
@@ -47,7 +47,7 @@ EOF
 cat > expected2.txt <<EOF
 bar
 EOF
-test_expect_failure 'Goto in subdirectory (conflicting push)' '
+test_expect_success 'Goto in subdirectory (conflicting push)' '
     (cd foo && stg goto p3) ;
     [ $? -eq 3 ] &&
     cat foo/bar > actual.txt &&

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* Re: [StGit PATCH 0/2] Make new infrastructure subdirectory safe
  2007-12-19 22:19         ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström
  2007-12-19 22:19           ` [StGit PATCH 1/2] Test that "stg goto" can be called from a subdirectory Karl Hasselström
  2007-12-19 22:24           ` [StGit PATCH 2/2] Make "stg goto" subdirectory safe Karl Hasselström
@ 2007-12-19 22:28           ` Karl Hasselström
  2 siblings, 0 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 22:28 UTC (permalink / raw
  To: Catalin Marinas; +Cc: git, David Kågedal

On 2007-12-19 23:19:23 +0100, Karl Hasselström wrote:

> Karl Hasselström (2):
>       Make "stg goto" subdirectory safe
>       Test that "stg goto" can be called from a subdirectory

I forgot to say, but this goes on top of kha/experimental. The test
makes use of the "return exit code 3 when there was conflicts" patch
to make sure that there was a conflict and not another error.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* kha/safe updated
  2007-12-19 22:24           ` [StGit PATCH 2/2] Make "stg goto" subdirectory safe Karl Hasselström
@ 2007-12-19 22:46             ` Karl Hasselström
  2007-12-19 23:17               ` Catalin Marinas
  2007-12-19 23:24               ` David Kågedal
  0 siblings, 2 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 22:46 UTC (permalink / raw
  To: Catalin Marinas; +Cc: git, David Kågedal

On 2007-12-19 23:24:49 +0100, Karl Hasselström wrote:

> And here it is!

And with that, I don't see any reason to not recommend that you pull
every patch I have. Which is:

The following changes since commit 5be69cd8d89bd89be31364e9c0fd9e947b6ef644:
  Karl Hasselström (1):
        Name the exit codes to improve legibility

are available in the git repository at:

  git://repo.or.cz/stgit/kha.git safe

David Kågedal (19):
      Add an StGit mode for emacs
      Emacs mode: Improve the output buffer state
      Emacs mode: Bind n and p
      Emacs mode: add stgit-repair
      Emacs mode: added stgit-commit and stgit-uncommit
      Emacs mode: Add stgit-edit command
      Emacs mode: added fontification
      Emacs mode: Added stgit-new
      Check bottom and invariants
      Remove the 'bottom' field
      Remove the 'top' field
      Split git.merge into two functions
      Leave working dir and index alone after failed (conflicting) push
      Added a test case to check what happens when push finds a conflict
      Simplify merge_recursive
      Use the output from merge-recursive to list conflicts
      Ask git about unmerged files
      Emacs mode: Add mark command
      Emacs mode: coalesce command

Karl Hasselström (36):
      Emacs mode: Show keybindings when user presses "h" or "?"
      Emacs mode: Add an explanatory header
      Emacs mode: Makefile for building stgit.el
      Emacs mode: push/pop next patch, not patch at point
      Emacs mode: Let "P" push or pop patch at point
      Emacs mode: Bind "G" to "stg goto"
      Emacs mode: show patches' short description
      Write removed fields for backwards compatibility
      Nicer conflict markers
      Better error message if merge fails
      Fix "stg resolved" to work with new conflict representation
      Refactoring: pass more than one file to resolved()
      We keep the different stages of a conflict in the index now
      "stg status --reset" is not needed anymore
      Remove "stg add"
      Remove "stg rm"
      Remove "stg cp"
      Remove "stg resolved"
      New StGit core infrastructure: repository operations
      Write metadata files used by the old infrastructure
      Upgrade older stacks to newest version
      Let "stg clean" use the new infrastructure
      Add "stg coalesce"
      Let "stg applied" and "stg unapplied" use the new infrastructure
      Teach the new infrastructure about the index and worktree
      Let "stg clean" use the new transaction primitives
      Let "stg goto" use the new infrastructure
      Convert "stg uncommit" to the new infrastructure
      New infrastructure: Make sure that the branch is initialized
      Expose transaction abort function
      stg coalesce: Support --file and --save-template
      Set exit code to 3 on merge conflict
      Convert "stg commit" to new infrastructure
      Make "stg commit" fancier
      Test that "stg goto" can be called from a subdirectory
      Make "stg goto" subdirectory safe

 Documentation/stg-cp.txt      |   63 -------
 Documentation/stg.txt         |    2 -
 Documentation/tutorial.txt    |   31 ++--
 contrib/Makefile              |   19 ++
 contrib/stgit-completion.bash |    4 +-
 contrib/stgit.el              |  377 +++++++++++++++++++++++++++++++++++++++
 examples/gitconfig            |   19 +--
 setup.py                      |    2 +-
 stgit/commands/add.py         |   44 -----
 stgit/commands/applied.py     |   27 ++--
 stgit/commands/clean.py       |   49 ++----
 stgit/commands/coalesce.py    |  122 +++++++++++++
 stgit/commands/commit.py      |  111 ++++++++-----
 stgit/commands/common.py      |   39 ++---
 stgit/commands/copy.py        |   45 -----
 stgit/commands/goto.py        |   52 ++----
 stgit/commands/pick.py        |    2 +-
 stgit/commands/resolved.py    |   94 ----------
 stgit/commands/rm.py          |   48 -----
 stgit/commands/status.py      |   31 ++--
 stgit/commands/sync.py        |    1 -
 stgit/commands/unapplied.py   |   23 ++--
 stgit/commands/uncommit.py    |   81 ++++-----
 stgit/config.py               |    1 -
 stgit/git.py                  |   75 +++++---
 stgit/gitmergeonefile.py      |   97 +----------
 stgit/lib/__init__.py         |   18 ++
 stgit/lib/git.py              |  388 +++++++++++++++++++++++++++++++++++++++++
 stgit/lib/stack.py            |  176 +++++++++++++++++++
 stgit/lib/stackupgrade.py     |   98 +++++++++++
 stgit/lib/transaction.py      |  209 ++++++++++++++++++++++
 stgit/main.py                 |   14 +-
 stgit/run.py                  |   12 +-
 stgit/stack.py                |  156 ++++-------------
 stgit/utils.py                |   25 +++
 t/t0002-status.sh             |   15 +-
 t/t1200-push-modified.sh      |    2 +-
 t/t1202-push-undo.sh          |    6 +-
 t/t1203-push-conflict.sh      |   70 ++++++++
 t/t1204-pop-keep.sh           |    2 +-
 t/t1205-push-subdir.sh        |    8 +-
 t/t1300-uncommit.sh           |   16 +-
 t/t1301-repair.sh             |    2 +-
 t/t1400-patch-history.sh      |    4 +-
 t/t1500-float.sh              |   14 +-
 t/t1600-delete-one.sh         |   12 +-
 t/t1601-delete-many.sh        |    2 +-
 t/t1700-goto-top.sh           |    2 +-
 t/t2000-sync.sh               |   12 +-
 t/t2100-pull-policy-fetch.sh  |    4 +-
 t/t2101-pull-policy-pull.sh   |    4 +-
 t/t2102-pull-policy-rebase.sh |    4 +-
 t/t2300-refresh-subdir.sh     |    2 +-
 t/t2600-coalesce.sh           |   31 ++++
 t/t2800-goto-subdir.sh        |   59 ++++++
 55 files changed, 1959 insertions(+), 867 deletions(-)
 delete mode 100644 Documentation/stg-cp.txt
 create mode 100644 contrib/Makefile
 create mode 100644 contrib/stgit.el
 delete mode 100644 stgit/commands/add.py
 create mode 100644 stgit/commands/coalesce.py
 delete mode 100644 stgit/commands/copy.py
 delete mode 100644 stgit/commands/resolved.py
 delete mode 100644 stgit/commands/rm.py
 create mode 100644 stgit/lib/__init__.py
 create mode 100644 stgit/lib/git.py
 create mode 100644 stgit/lib/stack.py
 create mode 100644 stgit/lib/stackupgrade.py
 create mode 100644 stgit/lib/transaction.py
 create mode 100755 t/t1203-push-conflict.sh
 create mode 100755 t/t2600-coalesce.sh
 create mode 100755 t/t2800-goto-subdir.sh

kha/experimental points to the same commit as kha/safe, for now.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe updated
  2007-12-19 22:46             ` kha/safe updated Karl Hasselström
@ 2007-12-19 23:17               ` Catalin Marinas
  2007-12-19 23:26                 ` Karl Hasselström
  2007-12-19 23:24               ` David Kågedal
  1 sibling, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 23:17 UTC (permalink / raw
  To: Karl Hasselström; +Cc: git, David Kågedal

On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> On 2007-12-19 23:24:49 +0100, Karl Hasselström wrote:
>
> > And here it is!
>
> And with that, I don't see any reason to not recommend that you pull
> every patch I have. Which is:

Please rebase again when you have time since I already merged most of
this branch and added some patches that might conflict with yours.

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe updated
  2007-12-19 22:46             ` kha/safe updated Karl Hasselström
  2007-12-19 23:17               ` Catalin Marinas
@ 2007-12-19 23:24               ` David Kågedal
  2007-12-20  6:38                 ` Karl Hasselström
  1 sibling, 1 reply; 57+ messages in thread
From: David Kågedal @ 2007-12-19 23:24 UTC (permalink / raw
  To: Catalin Marinas, Karl Hasselström; +Cc: git

Karl Hasselström <kha@treskal.com> writes:

> On 2007-12-19 23:24:49 +0100, Karl Hasselström wrote:
>
>> And here it is!
>
> And with that, I don't see any reason to not recommend that you pull
> every patch I have. Which is:

The conflict series of patches from me works for me, but I know that I
don't use all the merging features that other users use, so I can't
guarantee that everything works. But it seems that Catalin has been
looking over it, so I guess it's ok.

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe updated
  2007-12-19 23:17               ` Catalin Marinas
@ 2007-12-19 23:26                 ` Karl Hasselström
  2007-12-19 23:29                   ` Catalin Marinas
  0 siblings, 1 reply; 57+ messages in thread
From: Karl Hasselström @ 2007-12-19 23:26 UTC (permalink / raw
  To: Catalin Marinas; +Cc: git, David Kågedal

On 2007-12-19 23:17:42 +0000, Catalin Marinas wrote:

> On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>
> > And with that, I don't see any reason to not recommend that you
> > pull every patch I have. Which is:
>
> Please rebase again when you have time since I already merged most
> of this branch and added some patches that might conflict with
> yours.

You hadn't pushed any of it out when I last checked about two hours
ago ...

Will do, but not tonight. In fact, it may be a few days, I'm afraid.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe updated
  2007-12-19 23:26                 ` Karl Hasselström
@ 2007-12-19 23:29                   ` Catalin Marinas
  2007-12-20  6:39                     ` Karl Hasselström
  0 siblings, 1 reply; 57+ messages in thread
From: Catalin Marinas @ 2007-12-19 23:29 UTC (permalink / raw
  To: Karl Hasselström; +Cc: git, David Kågedal

On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> On 2007-12-19 23:17:42 +0000, Catalin Marinas wrote:
>
> > On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
> >
> > > And with that, I don't see any reason to not recommend that you
> > > pull every patch I have. Which is:
> >
> > Please rebase again when you have time since I already merged most
> > of this branch and added some patches that might conflict with
> > yours.
>
> You hadn't pushed any of it out when I last checked about two hours
> ago ...

I just pushed the changes a few minutes ago.

> Will do, but not tonight. In fact, it may be a few days, I'm afraid.

No problem. Anyway, if I don't here from you in the meantime, have a
good Christmas :-).

-- 
Catalin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe updated
  2007-12-19 23:24               ` David Kågedal
@ 2007-12-20  6:38                 ` Karl Hasselström
  0 siblings, 0 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-20  6:38 UTC (permalink / raw
  To: David Kågedal; +Cc: Catalin Marinas, git

On 2007-12-20 00:24:11 +0100, David Kågedal wrote:

> Karl Hasselström <kha@treskal.com> writes:
>
> > And with that, I don't see any reason to not recommend that you
> > pull every patch I have. Which is:
>
> The conflict series of patches from me works for me, but I know that
> I don't use all the merging features that other users use, so I
> can't guarantee that everything works. But it seems that Catalin has
> been looking over it, so I guess it's ok.

I've been running it for quite some time too. And the criteria for
getting into kha/stable aren't _that_ onerous: I don't guarantee that
there are no bugs, just that the patches seem to be ready for
widespread testing.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: kha/safe updated
  2007-12-19 23:29                   ` Catalin Marinas
@ 2007-12-20  6:39                     ` Karl Hasselström
  0 siblings, 0 replies; 57+ messages in thread
From: Karl Hasselström @ 2007-12-20  6:39 UTC (permalink / raw
  To: Catalin Marinas; +Cc: git, David Kågedal

On 2007-12-19 23:29:13 +0000, Catalin Marinas wrote:

> On 19/12/2007, Karl Hasselström <kha@treskal.com> wrote:
>
> > You hadn't pushed any of it out when I last checked about two
> > hours ago ...
>
> I just pushed the changes a few minutes ago.

So I guessed. :-)

> > Will do, but not tonight. In fact, it may be a few days, I'm
> > afraid.
>
> No problem. Anyway, if I don't here from you in the meantime, have a
> good Christmas :-).

You too! (Or anything else you may prefer to celebrate this time of
year.)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2007-12-20  6:40 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14 10:55 [StGit PATCH 00/17] Series short description David Kågedal
2007-12-14 10:55 ` [StGit PATCH 01/17] Add an StGit mode for emacs David Kågedal
2007-12-14 10:56 ` [StGit PATCH 02/17] Emacs mode: Show keybindings when user presses "h" or "?" David Kågedal
2007-12-14 10:56 ` [StGit PATCH 03/17] Emacs mode: Add an explanatory header David Kågedal
2007-12-14 10:57 ` [StGit PATCH 04/17] Emacs mode: Makefile for building stgit.el David Kågedal
2007-12-14 10:57 ` [StGit PATCH 05/17] Emacs mode: push/pop next patch, not patch at point David Kågedal
2007-12-14 10:57 ` [StGit PATCH 06/17] Emacs mode: Let "P" push or pop " David Kågedal
2007-12-14 10:57 ` [StGit PATCH 07/17] Emacs mode: Bind "G" to "stg goto" David Kågedal
2007-12-14 10:57 ` [StGit PATCH 08/17] Emacs mode: show patches' short description David Kågedal
2007-12-14 10:58 ` [StGit PATCH 09/17] Emacs mode: Improve the output buffer state David Kågedal
2007-12-14 10:58 ` [StGit PATCH 10/17] Emacs mode: Bind n and p David Kågedal
2007-12-14 10:58 ` [StGit PATCH 11/17] Emacs mode: add stgit-repair David Kågedal
2007-12-14 10:58 ` [StGit PATCH 12/17] Emacs mode: added stgit-commit and stgit-uncommit David Kågedal
2007-12-14 10:59 ` [StGit PATCH 13/17] Emacs mode: Add stgit-edit command David Kågedal
2007-12-14 10:59 ` [StGit PATCH 14/17] Emacs mode: added fontification David Kågedal
2007-12-14 10:59 ` [StGit PATCH 15/17] Emacs mode: Added stgit-new David Kågedal
2007-12-14 10:59 ` [StGit PATCH 16/17] Emacs mode: Add mark command David Kågedal
2007-12-14 10:59 ` [StGit PATCH 17/17] Emacs mode: coalesce command David Kågedal
2007-12-17 11:09 ` [StGit PATCH 00/17] Series short description Catalin Marinas
2007-12-17 22:48   ` Karl Hasselström
2007-12-18  5:21     ` kha/safe and kha/experimental updated Karl Hasselström
2007-12-18 16:09       ` Catalin Marinas
2007-12-18 16:39         ` Jakub Narebski
2007-12-18 16:52           ` Catalin Marinas
2007-12-19  9:41             ` David Kågedal
2007-12-19  9:50               ` David Kågedal
2007-12-19 10:19               ` Catalin Marinas
2007-12-19  9:38           ` Karl Hasselström
2007-12-19 10:44             ` Jakub Narebski
2007-12-19 11:40               ` Karl Hasselström
2007-12-19 11:47                 ` Catalin Marinas
2007-12-19 16:23                 ` Jakub Narebski
2007-12-19 17:02                   ` Catalin Marinas
2007-12-19 17:14                     ` David Kågedal
2007-12-19 17:14                   ` Karl Hasselström
2007-12-19  9:34         ` Karl Hasselström
2007-12-19 10:09           ` Catalin Marinas
2007-12-19 11:20             ` Karl Hasselström
2007-12-19 11:40               ` Catalin Marinas
2007-12-19 12:10                 ` Karl Hasselström
2007-12-19 15:38         ` Catalin Marinas
2007-12-19 14:59       ` Catalin Marinas
2007-12-19 15:39         ` David Kågedal
2007-12-18  9:11     ` [StGit PATCH 00/17] Series short description Catalin Marinas
2007-12-18  9:20       ` David Kågedal
2007-12-18  9:24       ` Karl Hasselström
2007-12-19 22:19         ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström
2007-12-19 22:19           ` [StGit PATCH 1/2] Test that "stg goto" can be called from a subdirectory Karl Hasselström
2007-12-19 22:24           ` [StGit PATCH 2/2] Make "stg goto" subdirectory safe Karl Hasselström
2007-12-19 22:46             ` kha/safe updated Karl Hasselström
2007-12-19 23:17               ` Catalin Marinas
2007-12-19 23:26                 ` Karl Hasselström
2007-12-19 23:29                   ` Catalin Marinas
2007-12-20  6:39                     ` Karl Hasselström
2007-12-19 23:24               ` David Kågedal
2007-12-20  6:38                 ` Karl Hasselström
2007-12-19 22:28           ` [StGit PATCH 0/2] Make new infrastructure subdirectory safe Karl Hasselström

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).