Git development
 help / color / mirror / Atom feed
* Re: git-cvsexportcommit fails for huge commits
From: Robin Rosenberg @ 2007-12-14 13:47 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, Markus Klinik, git
In-Reply-To: <20071214091546.GA20907@coredump.intra.peff.net>

fredag 14 december 2007 skrev Jeff King:
> On Thu, Dec 13, 2007 at 11:45:54PM -0500, Jeff King wrote:
> 
> > So it seems that we could probably go with something more like 64K, and
> > then only truly pathological cases should trigger the behavior.
> 
> So here is a cleaned up patch. It bumps the maximum size to 64kB, adds
> scalar support (nobody uses it, but it makes sense for the interface to
> match that of safe_pipe_capture -- I am even tempted to just replace
> safe_pipe_capture entirely and convert the few other callers), and
> cleans up the unused safe_pipe_capture_blob.

Wouldn't using the POSIX::ARG_MAX constant work?

-- robin

^ permalink raw reply

* Re: [PATCH] provide advance warning of some future pack default changes
From: Nicolas Pitre @ 2007-12-14 13:38 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Junio C Hamano, git
In-Reply-To: <m3fxy5qwbq.fsf@roke.D-201>

On Fri, 14 Dec 2007, Jakub Narebski wrote:

> Nicolas Pitre <nico@cam.org> writes:
> 
> > + * From v1.5.5, the repack.usedeltabaseoffset config option will default
> > +   to true, which will give denser packfile (i.e. more efficient storage).
> > +   The downside is that git older than version 1.4.4 will not be able
> > +   to directly use a repository packed using this setting.
> > +
> > + * From v1.5.5, the pack.indexversion config option will default to 2,
> > +   which is slightly more efficient, and makes repacking more immune to
> > +   data corruptions.  Git older than version 1.5.2 may revert to version 1
> > +   of the pack index with a manual "git index-pack" to be able to directly
> > +   access corresponding pack files.
> 
> Which means what? Local clone with shortcut (hardlinking and remotes)?
> Dumb protocols (http, ftp, rsync)?

Right, or simply shared repo over NFS or the like.

The 1.5.5 release notes will contain a note reminding people to set the 
corresponding config variables if they wish to retain the legacy 
behaviors.


Nicolas

^ permalink raw reply

* Re: Something is broken in repack
From: Nicolas Pitre @ 2007-12-14 13:25 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: git, gcc
In-Reply-To: <fjt6vm$n7d$1@ger.gmane.org>

On Fri, 14 Dec 2007, Paolo Bonzini wrote:

> > Hmmm... it is even documented in git-gc(1)... and git-index-pack(1) of
> > all things.
> 
> I found that the .keep file is not transmitted over the network (at least I
> tried with git+ssh:// and http:// protocols), however.

That is a local policy.


Nicolas

^ permalink raw reply

* Re: [PATCH] provide advance warning of some future pack default changes
From: Nicolas Pitre @ 2007-12-14 13:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vir31x38p.fsf@gitster.siamese.dyndns.org>

On Thu, 13 Dec 2007, Junio C Hamano wrote:

> Thanks.
> 
> Deprecating versions before 1.5.2 (May 20 2007) feels a bit too quick,
> but seven month is almost an eternity in git timescale, and by now
> anything older than 1.5.2 can safely be called prehistoric.  Will apply.

Well, index version 1 is not gone.  It's only the version used by 
default that will change, which can be overriden with a config variable.

And even if that wasn't done, then any old Git version can just blow 
away the new index and recreate it.  So it is not like if you actually 
needed a recent version of Git to convert the repo back to the old 
format.

And all this will be effective in 1.5.5 which is still a few months 
ahead.


Nicolas

^ permalink raw reply

* Re: [PATCH] provide advance warning of some future pack default changes
From: Jakub Narebski @ 2007-12-14 12:45 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.LFD.0.999999.0712132227090.8467@xanadu.home>

Nicolas Pitre <nico@cam.org> writes:

> + * From v1.5.5, the repack.usedeltabaseoffset config option will default
> +   to true, which will give denser packfile (i.e. more efficient storage).
> +   The downside is that git older than version 1.4.4 will not be able
> +   to directly use a repository packed using this setting.
> +
> + * From v1.5.5, the pack.indexversion config option will default to 2,
> +   which is slightly more efficient, and makes repacking more immune to
> +   data corruptions.  Git older than version 1.5.2 may revert to version 1
> +   of the pack index with a manual "git index-pack" to be able to directly
> +   access corresponding pack files.

Which means what? Local clone with shortcut (hardlinking and remotes)?
Dumb protocols (http, ftp, rsync)?

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply

* Re: git gui blame utf-8 bugs
From: Jakub Narebski @ 2007-12-14 12:39 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Finn Arne Gangstad, git
In-Reply-To: <20071214064709.GH14735@spearce.org>

"Shawn O. Pearce" <spearce@spearce.org> writes:

> Finn Arne Gangstad <finnag@pvv.org> wrote:
> > git gui has some utf-8 bugs:
> 
> It has several.  :-)
>  
> > If you do git gui blame <file>, and the file contains utf-8 text,
> > the lines are not parsed as utf-8, but seemingly as iso-8859-1 instead.
> 
> Right.  git-gui is keying off the environment setting for LANG, so I
> guess its set to iso-8859-1 on your system but you are working with a
> utf-8 file.  We've talked about using something like .gitattributes
> to store encoding hints, or to just put a global gui setting in
> ~/.gitconfig but neither has had any patches written for it.
> 
> UTF-8 is seemingly the most common encoding that git-gui is mangling
> so maybe we should be defaulting to utf-8 until someone codes a
> more intelligent patch.

Currently there is no config variable for default encoding of file
contents (of blobs) and of filenames (of trees) because those do not
matter for core git.  But they do matter for GUI.
 
> > Also, the hovering comment is INITIALLY shown garbled (both Author and
> > commit message), but if you click on a line, so that the commit
> > message is shown in the bottom window, the hovering message is
> > magically corrected to utf-8.
> > 
> > The text in the lower window (showing specific commits) seems to
> > always be handled correctly.
> 
> That's a "feature".  :-)
> 
> What's happening here is the initial hovering message is obtained
> from the machine formatted output from `git blame --incremental`
> and in that format there is no encoding header so I'm just ignoring
> any encoding problems.

So the correct solution would be to enhance "git blame --incremental"
to output 'encoding' header when needed (when commit has encoding
header and it is different from log output encoding).

> Later when you click on a line it does `git cat-file commit $sha1`
> and gets the proper encoding, and corrects the strings it originally
> had gotten from git-blame.  So the hovering message "fixes" itself
> later on.
> 
> Maybe here too we should be defaulting to utf-8 instead of the
> native encoding.

I think this is a good idea, as git repositories are meant to be
cross-operating system (which means cross-delault-encodings)
compatible.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH] provide advance warning of some future pack default changes
From: linux @ 2007-12-14 11:28 UTC (permalink / raw)
  To: git; +Cc: linux

>+ * From v1.5.5, the pack.indexversion config option will default to 2,
>+   which is slightly more efficient, and makes repacking more immune to
>+   data corruptions.  Git older than version 1.5.2 may revert to version 1
>+   of the pack index with a manual "git index-pack" to be able to directly
>+   access corresponding pack files.

You might want to mention that it's slightly more TIME efficient,
but takes 16% more space (28 bytes per object rather than 24).

If it helps, I documented the v2 index file format (a lot stolen
from commit c553ca25bd60dc9fd50b8bc7bd329601b81cee66 message).
(Public domain, copyright abandoned, if it breaks you get to keep both
pieces, yadda yadda.)

diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt
index e5b31c8..a80baa4 100644
--- a/Documentation/technical/pack-format.txt
+++ b/Documentation/technical/pack-format.txt
@@ -1,9 +1,9 @@
 GIT pack format
 ===============
 
-= pack-*.pack file has the following format:
+= pack-*.pack files have the following format:
 
-   - The header appears at the beginning and consists of the following:
+   - A header appears at the beginning and consists of the following:
 
      4-byte signature:
          The signature is: {'P', 'A', 'C', 'K'}
@@ -34,18 +34,14 @@ GIT pack format
 
   - The trailer records 20-byte SHA1 checksum of all of the above.
 
-= pack-*.idx file has the following format:
+= Original (version 1) pack-*.idx files have the following format:
 
   - The header consists of 256 4-byte network byte order
     integers.  N-th entry of this table records the number of
     objects in the corresponding pack, the first byte of whose
-    object name are smaller than N.  This is called the
+    object name is less than or equal to N.  This is called the
     'first-level fan-out' table.
 
-    Observation: we would need to extend this to an array of
-    8-byte integers to go beyond 4G objects per pack, but it is
-    not strictly necessary.
-
   - The header is followed by sorted 24-byte entries, one entry
     per object in the pack.  Each entry is:
 
@@ -55,10 +51,6 @@ GIT pack format
 
     20-byte object name.
 
-    Observation: we would definitely need to extend this to
-    8-byte integer plus 20-byte object name to handle a packfile
-    that is larger than 4GB.
-
   - The file is concluded with a trailer:
 
     A copy of the 20-byte SHA1 checksum at the end of
@@ -68,31 +60,30 @@ GIT pack format
 
 Pack Idx file:
 
-	idx
-	    +--------------------------------+
-	    | fanout[0] = 2                  |-.
-	    +--------------------------------+ |
+	--  +--------------------------------+
+fanout	    | fanout[0] = 2 (for example)    |-.
+table	    +--------------------------------+ |
 	    | fanout[1]                      | |
 	    +--------------------------------+ |
 	    | fanout[2]                      | |
 	    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
-	    | fanout[255]                    | |
-	    +--------------------------------+ |
-main	    | offset                         | |
-index	    | object name 00XXXXXXXXXXXXXXXX | |
-table	    +--------------------------------+ |
-	    | offset                         | |
-	    | object name 00XXXXXXXXXXXXXXXX | |
-	    +--------------------------------+ |
-	  .-| offset                         |<+
-	  | | object name 01XXXXXXXXXXXXXXXX |
-	  | +--------------------------------+
-	  | | offset                         |
-	  | | object name 01XXXXXXXXXXXXXXXX |
-	  | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	  | | offset                         |
-	  | | object name FFXXXXXXXXXXXXXXXX |
-	  | +--------------------------------+
+	    | fanout[255] = total objects    |---.
+	--  +--------------------------------+ | |
+main	    | offset                         | | |
+index	    | object name 00XXXXXXXXXXXXXXXX | | |
+table	    +--------------------------------+ | |
+	    | offset                         | | |
+	    | object name 00XXXXXXXXXXXXXXXX | | |
+	    +--------------------------------+<+ |
+	  .-| offset                         |   |
+	  | | object name 01XXXXXXXXXXXXXXXX |   |
+	  | +--------------------------------+   |
+	  | | offset                         |   |
+	  | | object name 01XXXXXXXXXXXXXXXX |   |
+	  | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   |
+	  | | offset                         |   |
+	  | | object name FFXXXXXXXXXXXXXXXX |   |
+	--| +--------------------------------+<--+
 trailer	  | | packfile checksum              |
 	  | +--------------------------------+
 	  | | idxfile checksum               |
@@ -116,3 +107,40 @@ Pack file entry: <+
 	  20-byte base object name SHA1 (the size above is the
 		size of the delta data that follows).
           delta data, deflated.
+
+
+= Version 2 pack-*.idx files support packs larger than 4 GiB, and
+  have some other reorganizations.  They have the format:
+
+  - A 4-byte magic number '\377tOc' which is an unreasonable
+    fanout[0] value.
+
+  - A 4-byte version number (= 2)
+
+  - A 256-entry fan-out table just like v1.
+
+  - A table of sorted 20-byte SHA1 object names.  These are
+    packed together without offset values to reduce the cache
+    footprint of the binary search for a specific object name.
+
+  - A table of 4-byte CRC32 values of the packed object data.
+    This is new in v2 so compressed data can be copied directly
+    from pack to pack during repacking withough undetected
+    data corruption.
+
+  - A table of 4-byte offset values (in network byte order).
+    These are usually 31-bit pack file offsets, but large
+    offsets are encoded as an index into the next table with
+    the msbit set.
+
+  - A table of 8-byte offset entries (empty for pack files less
+    than 2 GiB).  Pack files are organized with heavily used
+    objects toward the front, so most object references should
+    not need to refer to this table.
+
+  - The same trailer as a v1 pack file:
+
+    A copy of the 20-byte SHA1 checksum at the end of
+    corresponding packfile.
+
+    20-byte SHA1-checksum of all of the above.

^ permalink raw reply related

* [PATCH 2/3] Use shorter error messages for whitespace problems
From: Wincent Colaiuta @ 2007-12-14 11:23 UTC (permalink / raw)
  To: git; +Cc: gitster, Wincent Colaiuta
In-Reply-To: <1197631424-52586-2-git-send-email-win@wincent.com>

The initial version of the whitespace_error_string() function took the
messages from builtin-apply.c rather than the shorter messages from
diff.c.

This commit addresses Junio's concern that these messages might be too
long (now that we can emit multiple warnings per line).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
---
 t/t4015-diff-whitespace.sh |    2 +-
 ws.c                       |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 05ef78b..9bff8f5 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -121,7 +121,7 @@ test_expect_success 'check mixed spaces and tabs in indent' '
 
 	# This is indented with SP HT SP.
 	echo " 	 foo();" > x &&
-	git diff --check | grep "Space in indent is followed by a tab"
+	git diff --check | grep "space before tab in indent"
 
 '
 
diff --git a/ws.c b/ws.c
index d7d1522..46cbdd6 100644
--- a/ws.c
+++ b/ws.c
@@ -101,16 +101,16 @@ char *whitespace_error_string(unsigned ws)
 	struct strbuf err;
 	strbuf_init(&err, 0);
 	if (ws & WS_TRAILING_SPACE)
-		strbuf_addstr(&err, "Adds trailing whitespace");
+		strbuf_addstr(&err, "trailing whitespace");
 	if (ws & WS_SPACE_BEFORE_TAB) {
 		if (err.len)
 			strbuf_addstr(&err, ", ");
-		strbuf_addstr(&err, "Space in indent is followed by a tab");
+		strbuf_addstr(&err, "space before tab in indent");
 	}
 	if (ws & WS_INDENT_WITH_NON_TAB) {
 		if (err.len)
 			strbuf_addstr(&err, ", ");
-		strbuf_addstr(&err, "Indent more than 8 places with spaces");
+		strbuf_addstr(&err, "indent with spaces");
 	}
 	return strbuf_detach(&err, NULL);
 }
-- 
1.5.4.rc0.1099.g76fa0-dirty

^ permalink raw reply related

* [PATCH 0/3] diff topic tweaks
From: Wincent Colaiuta @ 2007-12-14 11:23 UTC (permalink / raw)
  To: git; +Cc: gitster

I've eyeballed and done some testing of the changes that Junio
pushed out to "next" and they all look good to me.

Some minor adjustments:

[1/3] Revert changes and extend diff option documentation

Seeing as Junio's adjustments changed the behaviour, the
documentation needs to be changed as well.

[2/3] Use shorter error messages for whitespace problems

Cosmetic only.

[3/3] Test interaction between diff --check and --exit-code

Just to make sure it does what we think it does (and it does).

Cheers,
Wincent

^ permalink raw reply

* [PATCH 1/3] Revert changes and extend diff option documentation
From: Wincent Colaiuta @ 2007-12-14 11:23 UTC (permalink / raw)
  To: git; +Cc: gitster, Wincent Colaiuta
In-Reply-To: <1197631424-52586-1-git-send-email-win@wincent.com>

Revert the part of 62c6489 which says that --check affects
the exit code of "git diff"; as of da31b35 this is only true
if you pass --exit-code as well or disable the pager with
--no-pager or GIT_PAGER=cat.

Instead extend the discussion of the --exit-code switch.

Also, instead of hard-coding "what whitespace errors are",
mention that their classification can be controlled via
config and per-path attributes.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
---
 Documentation/diff-options.txt |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9ecc1d7..54207f0 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -92,10 +92,10 @@ endif::git-format-patch[]
 	file gives the default to do so.
 
 --check::
-	Warn if changes introduce trailing whitespace
-	or an indent that uses a space before a tab. Exits with
-	non-zero status if problems are found. Not compatible with
-	--exit-code.
+	Warn if changes introduce whitespace problems (such as
+	trailing whitespace). Configuration and per-path attributes
+	control what git classifies as a whitespace problem (see
+	gitlink:git-config[1] and gitlink:gitattributes[5]).
 
 --full-index::
 	Instead of the first handful characters, show full
@@ -197,8 +197,9 @@ endif::git-format-patch[]
 
 --exit-code::
 	Make the program exit with codes similar to diff(1).
-	That is, it exits with 1 if there were differences and
-	0 means no differences.
+	That is, it exits with 0 if there were no differences
+	and 1 if there were. If --check is used and the
+	differences introduce whitespace problems exits with 3.
 
 --quiet::
 	Disable all output of the program. Implies --exit-code.
-- 
1.5.4.rc0.1099.g76fa0-dirty

^ permalink raw reply related

* [PATCH 3/3] Test interaction between diff --check and --exit-code
From: Wincent Colaiuta @ 2007-12-14 11:23 UTC (permalink / raw)
  To: git; +Cc: gitster, Wincent Colaiuta
In-Reply-To: <1197631424-52586-3-git-send-email-win@wincent.com>

Make sure that it works as advertised in the man page.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
---
 t/t4017-diff-retval.sh |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index 6873190..dc0b712 100755
--- a/t/t4017-diff-retval.sh
+++ b/t/t4017-diff-retval.sh
@@ -76,4 +76,33 @@ test_expect_success 'git diff-index --cached HEAD' '
 	}
 '
 
+test_expect_success '--check --exit-code returns 0 for no difference' '
+
+	git diff --check --exit-code
+
+'
+
+test_expect_success '--check --exit-code returns 1 for a clean difference' '
+
+	echo "good" > a &&
+	git diff --check --exit-code
+	test $? = 1
+
+'
+
+test_expect_success '--check --exit-code returns 3 for a dirty difference' '
+
+	echo "bad   " >> a &&
+	git diff --check --exit-code
+	test $? = 3
+
+'
+
+test_expect_success '--check with --no-pager returns 2 for dirty difference' '
+
+	git --no-pager diff --check
+	test $? = 2
+
+'
+
 test_done
-- 
1.5.4.rc0.1099.g76fa0-dirty

^ permalink raw reply related

* [StGit PATCH 17/17] Emacs mode: coalesce command
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 15/17] Emacs mode: Added stgit-new
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 16/17] Emacs mode: Add mark command
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 14/17] Emacs mode: added fontification
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 13/17] Emacs mode: Add stgit-edit command
From: David Kågedal @ 2007-12-14 10:59 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 12/17] Emacs mode: added stgit-commit and stgit-uncommit
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 11/17] Emacs mode: add stgit-repair
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 10/17] Emacs mode: Bind n and p
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>


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

* [StGit PATCH 09/17] Emacs mode: Improve the output buffer state
From: David Kågedal @ 2007-12-14 10:58 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>

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

* [StGit PATCH 08/17] Emacs mode: show patches' short description
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>

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

* [StGit PATCH 07/17] Emacs mode: Bind "G" to "stg goto"
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>

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

* [StGit PATCH 06/17] Emacs mode: Let "P" push or pop patch at point
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>

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

* [StGit PATCH 05/17] Emacs mode: push/pop next patch, not patch at point
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>

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

* [StGit PATCH 04/17] Emacs mode: Makefile for building stgit.el
From: David Kågedal @ 2007-12-14 10:57 UTC (permalink / raw)
  To: catalin.marinas, git
In-Reply-To: <20071214105238.18066.23281.stgit@krank>

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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox