From: Jambunathan K <kjambunathan@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Git never commits, Magit never pushes
Date: Sun, 03 Apr 2011 14:45:25 +0530 [thread overview]
Message-ID: <81sjtzhf0y.fsf@gmail.com> (raw)
In-Reply-To: 80wrjb69je.fsf@somewhere.org
[-- Attachment #1: Type: text/plain, Size: 2954 bytes --]
> Hi Jambunathan,
>
> Jambunathan K wrote:
>> Have you tried vc-git that comes bundled with emacs.
>
> Now, yes. But it still does not interest me that much, as there is no
> interactive diff, which one tool I really need to compare buffers before
> committing.
I use ediff with git all the time.
Put vc-ediff.el (attached with this mail) in the load-path. Add the
following code to .emacs.
Now "x" on a vc-dir would hide update and unregistered files. (It will
only show added/modified files)
"C-x C-v =" on a version controlled buffer would launch ediff window.
I have been using this setup for a while so I know it works. If
something is broken it is possible that I haven't copy/pasted some stuff
from my init file.
--8<---------------cut here---------------start------------->8---
(require 'vc-ediff)
(add-hook 'vc-dir-mode-hook
(lambda nil
(define-key vc-dir-mode-map "x" 'my-vc-dir-hide-up-to-date)))
(defun my-vc-dir-hide-up-to-date ()
(interactive)
(vc-dir-hide-up-to-date)
(vc-dir-hide-unregistered))
(defun vc-dir-hide-unregistered ()
"Hide unregistered items from display."
(interactive)
(let ((crt (ewoc-nth vc-ewoc -1))
(first (ewoc-nth vc-ewoc 0)))
;; Go over from the last item to the first and remove the
;; unregistered files and directories with no child files.
(while (not (eq crt first))
(let* ((data (ewoc-data crt))
(dir (vc-dir-fileinfo->directory data))
(next (ewoc-next vc-ewoc crt))
(prev (ewoc-prev vc-ewoc crt))
;; ewoc-delete does not work without this...
(inhibit-read-only t))
(when (or
;; Remove directories with no child files.
(and dir
(or
;; Nothing follows this directory.
(not next)
;; Next item is a directory.
(vc-dir-fileinfo->directory (ewoc-data next))))
;; Remove files in the unregistered state.
(eq (vc-dir-fileinfo->state data) 'unregistered))
(ewoc-delete vc-ewoc crt))
(setq crt prev)))))
(defun my-ediff-revision (file rev1 &optional rev2)
"Run Ediff by comparing 'master' against the 'current'."
(find-file file)
(if (and (buffer-modified-p)
(y-or-n-p (format "Buffer %s is modified. Save buffer? "
(buffer-name))))
(save-buffer (current-buffer)))
(ediff-load-version-control)
(funcall
(intern (format "ediff-%S-internal" ediff-version-control-package))
rev1 rev2 nil))
(defun my-vc-diff (&optional arg)
(interactive "P")
(call-interactively
(cond (arg (lambda nil (interactive) (vc-diff nil)))
(t (lambda nil (interactive)
(my-ediff-revision (buffer-file-name)
(read-string "revision? " "HEAD" nil "HEAD")
""))))))
(define-key vc-prefix-map "=" 'my-vc-diff)
--8<---------------cut here---------------end--------------->8---
> I did not find yet, though, how to push it to the Git repo.
C-x v v commits to the local branch. I generally push to the remote repo
from the shell.
[-- Attachment #2: vc-ediff.el --]
[-- Type: application/emacs-lisp, Size: 2549 bytes --]
[-- Attachment #3: Type: text/plain, Size: 5 bytes --]
--
next prev parent reply other threads:[~2011-04-03 9:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-02 7:18 Git never commits, Magit never pushes Sébastien Vauban
2011-04-02 7:55 ` Jambunathan K
2011-04-02 14:05 ` Ian Barton
2011-04-03 20:51 ` PJ Weisberg
[not found] ` <mailman.7.1301730983.4225.help-gnu-emacs@gnu.org>
2011-04-03 8:09 ` Sébastien Vauban
2011-04-03 9:15 ` Jambunathan K [this message]
[not found] ` <mailman.13.1301822571.7560.help-gnu-emacs@gnu.org>
2011-04-05 11:50 ` Sébastien Vauban
2011-04-05 16:16 ` Jambunathan K
2011-04-05 16:23 ` Jambunathan K
2011-04-05 6:30 ` PJ Weisberg
[not found] ` <mailman.0.1301985049.6502.help-gnu-emacs@gnu.org>
2011-04-05 12:01 ` Sébastien Vauban
2011-04-15 20:14 ` PJ Weisberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81sjtzhf0y.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).