Commit 98cfec0d authored by Chong Yidong's avatar Chong Yidong

Backport VC improvements from trunk.

* vc/log-edit.el (log-edit-rewrite-fixes): New var.
(log-edit-author): New dynamic var.
(log-edit-changelog-ours-p, log-edit-insert-changelog-entries):
Use it to return the author if different from committer.
(log-edit-insert-changelog): Use them to add Author: and Fixes headers.

* vc/vc-hooks.el (vc-default-mode-line-string): Doc fix.

* vc/vc.el (vc-deduce-backend): New fun.  Handle diff buffers.
(vc-root-diff, vc-print-root-log, vc-log-incoming)
(vc-log-outgoing): Use it.
(vc-diff-internal): Set diff-vc-backend.

* vc/diff-mode.el (diff-vc-backend): New var.

* vc/vc.el (vc-diff-internal): Set `revert-buffer-function'
buffer-locally to lambda that re-runs the vc diff command.
(Bug#6447)

* vc/log-view.el (log-view-mode-map): Bind revert-buffer.

Make 'g' (AKA revert-buffer) rerun VC log, log-incoming and
log-outgoing commands.
* vc/vc.el (vc-log-internal-common): Add a new argument and use it
to create a buffer local revert-buffer-function variable.
(vc-print-log-internal, vc-log-incoming, vc-log-outgoing): Pass a
revert-buffer-function lambda.

Improve VC create/retrieve tag/branch.
* vc.el (vc-create-tag): Do not read the directory name for VCs
with repository revision granularity.  Adjust the tag/branch
prompt.  Reset VC properties.
(vc-retrieve-tag): Do not read the directory name for VCs
with repository revision granularity.  Reset VC properties.

Add optional support for resetting VC properties.
* vc-dispatcher.el (vc-resynch-window): Add new optional argument,
call vc-file-clearprops when true.
(vc-resynch-buffer): Add new optional argument, pass it down.
(vc-resynch-buffers-in-directory): Likewise.

Improve support for special markup in the VC commit message.
* vc-mtn.el (vc-mtn-checkin): Support Author: and Date: markup.
* vc-hg.el (vc-hg-checkin): Add support for Date:.
* vc-git.el (vc-git-checkin):
* vc-bzr.el (vc-bzr-checkin): Likewise.

Add support for vc-log-incoming, improve vc-log-outgoing for Git.
* vc-git.el (vc-git-log-view-mode): Fix font lock for
incoming/outgoing logs.
(vc-git-log-outgoing, vc-git-log-incoming): New functions.

* vc-git.el (vc-git-log-outgoing): Use the same format as the
short log.
(vc-git-log-incoming): Likewise.  Run "git fetch" before the log
command

Add bindings for vc-log-incoming and vc-log-outgoing.
* vc-hooks.el (vc-prefix-map): Add bindings for vc-log-incoming
and vc-log-outgoing.
* vc-dir.el (vc-dir-menu-map): Add menu bindings for vc-log-incoming
and vc-log-outgoing.

Improve state updating for VC tag commands.
* vc.el (vc-create-tag, vc-retrieve-tag): Call vc-resynch-buffer
to update the state of all buffers in the directory.

* vc-dir.el (vc-dir): Don't pop-up-windows.  (Bug#6204)

* vc.el (vc-checkin, vc-modify-change-comment):
Adjust to new vc-start/finish-logentry.
(vc-find-conflicted-file): New command.
(vc-transfer-file): Adjust to new vc-checkin.
(vc-next-action): Improve scoping.

* vc-git.el (vc-git-checkin): Use log-edit-extract-headers.
(vc-git-commits-coding-system): Rename from git-commits-coding-system.

* vc-dispatcher.el (vc-log-edit): Shorten names for
log-edit-show-files.

* vc-bzr.el (vc-bzr-checkin): Use log-edit-extract-headers.
(vc-bzr-conflicted-files): New function.

* log-edit.el (log-edit-summary, log-edit-header)
(log-edit-unknown-header): New faces.
(log-edit-headers-alist): New var.
(log-edit-header-contents-regexp): New const.
(log-edit-match-to-eoh): New function.
(log-edit-font-lock-keywords): Use them.
(log-edit): Insert a "Summary:" header as default.
(log-edit-mode): Mark font-lock rules as case-insensitive.
(log-edit-done): Cleanup headers.
(log-edit-extract-headers): New function to replace it.

* vc-dispatcher.el (vc-finish-logentry): Don't mess so badly with
the windows/frames.

* vc-bzr.el (vc-bzr-shelve-apply): Don't use *vc-bzr-shelve*.

* vc-dir.el (vc-dir-kill-line): New command.
(vc-dir-mode-map): Bind it to C-k.
(vc-dir-headers): Abbreviate the working dir.

* vc-git.el (vc-git-revision-table): Include remote branches.

New VC methods: vc-log-incoming and vc-log-outgoing.
* vc.el (vc-print-log-setup-buttons, vc-log-internal-common)
(vc-incoming-outgoing-internal, vc-log-incoming, vc-log-outgoing):
New functions.
(vc-print-log-internal): Just call vc-log-internal-common.
(vc-log-view-type): New permanent local variable.

* vc-hooks.el (vc-menu-map): Bind vc-log-incoming and vc-log-outgoing.

* vc-bzr.el (vc-bzr-log-view-mode): Use vc-log-view-type instead
of the dynamic bound vc-short-log.
(vc-bzr-log-incoming, vc-bzr-log-outgoing): New functions.

* vc-git.el (vc-git-log-outgoing): New function.
(vc-git-log-view-mode): Use vc-log-view-type instead
of the dynamic bound vc-short-log.

* vc-hg.el (vc-hg-log-view-mode): Use vc-log-view-type instead of
the dynamic bound vc-short-log.  Highlight the tag.
(vc-hg-log-incoming, vc-hg-log-outgoing): New functions.
(vc-hg-outgoing, vc-hg-incoming, vc-hg-outgoing-mode):
(vc-hg-incoming-mode): Remove.
(vc-hg-extra-menu-map): Do not bind vc-hg-incoming and vc-hg-outgoing.

Fix default-directory for vc-root-diff.
* vc.el (vc-root-diff): Bind default-directory to the root
directory for the diff command.

* vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling
`vc-hg-command' with a list of flags.

* vc-bzr.el (vc-bzr-log-edit-mode): Add --fixes support to
log-edit-before-checkin-process.

* vc.el (vc-modify-change-comment): Pass MODE to vc-start-logentry.

* vc-bzr.el, vc-hg.el (log-edit-mode): Declare.

* vc-dispatcher.el (vc-start-logentry): Doc fix.
(log-view-process-buffer, log-edit-extra-flags): Declare.

Add special markup processing for commit logs.
* log-edit.el (log-edit): Add new argument MODE.  Use that mode
when non-nil instead of the log-view-mode.

* vc.el (vc-default-log-edit-mode): New function.

* vc-dispatcher.el (vc-log-edit): Add a mode argument, pass it to
log-edit.

Support for shelving snapshots and for showing shelves.
* vc-bzr.el (vc-bzr-shelve-show, vc-bzr-shelve-show-at-point)
(vc-bzr-shelve-apply-and-keep-at-point, vc-bzr-shelve-snapshot):
New functions.
(vc-bzr-shelve-map, vc-bzr-shelve-menu-map)
(vc-bzr-extra-menu-map): Map them.
parent 6aad7ea0
......@@ -34,6 +34,42 @@ alt/option key by customizing the value for ns-right-alternate-modifier.
** The appt-add command takes an optional argument for the warning time.
This can be used in place of the default appt-message-warning-time.
** VC and related modes
*** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file.
**** vc-log-incoming for Git runs "git fetch" so that the necessary
data is available locally.
**** vc-log-incoming and vc-log-outgoing for Git require version 1.7 (or newer).
*** New key bindings: C-x v I and C-x v O bound to vc-log-incoming and
vc-log-outgoing, respectively.
*** The 'g' key in VC diff, log, log-incoming and log-outgoing buffers
reruns the corresponding VC command to compute an up to date version
of the buffer.
*** vc-dir for Bzr supports viewing shelve contents and shelving snapshots.
*** Special markup can be added to log-edit buffers.
The log-edit buffers are expected to have a format similar to email messages
with headers of the form:
Author: <author of this change>
Summary: <one line summary of this change>
Fixes: <reference to the bug fixed by this change>
Some backends handle some of those headers specially, but any unknown header
is just left as is in the message, so it is not lost.
**** vc-git handles Author: and Date:
**** vc-hg handles Author: and Date:
**** vc-bzr handles Author:, Date: and Fixes:
**** vc-mtn handles Author: and Date:
*** Pressing g in a *vc-diff* buffer reruns vc-diff, so it will
produce an up to date diff.
** Obsolete packages
+++
......
2010-10-31 Stefan Monnier <monnier@iro.umontreal.ca>
* vc/log-edit.el (log-edit-rewrite-fixes): New var.
(log-edit-author): New dynamic var.
(log-edit-changelog-ours-p, log-edit-insert-changelog-entries):
Use it to return the author if different from committer.
(log-edit-insert-changelog): Use them to add Author: and Fixes headers.
2010-10-31 Eli Zaretskii <eliz@gnu.org>
* vc/vc-hooks.el (vc-default-mode-line-string): Doc fix.
2010-10-31 Chong Yidong <cyd@stupidchicken.com>
* vc/vc.el (vc-deduce-backend): New fun. Handle diff buffers.
(vc-root-diff, vc-print-root-log, vc-log-incoming)
(vc-log-outgoing): Use it.
(vc-diff-internal): Set diff-vc-backend.
* vc/diff-mode.el (diff-vc-backend): New var.
2010-10-31 Juri Linkov <juri@jurta.org>
* vc/vc.el (vc-diff-internal): Set `revert-buffer-function'
buffer-locally to lambda that re-runs the vc diff command.
(Bug#6447)
2010-10-31 Dan Nicolaescu <dann@ics.uci.edu>
* vc/log-view.el (log-view-mode-map): Bind revert-buffer.
Make 'g' (AKA revert-buffer) rerun VC log, log-incoming and
log-outgoing commands.
* vc/vc.el (vc-log-internal-common): Add a new argument and use it
to create a buffer local revert-buffer-function variable.
(vc-print-log-internal, vc-log-incoming, vc-log-outgoing): Pass a
revert-buffer-function lambda.
Improve VC create/retrieve tag/branch.
* vc.el (vc-create-tag): Do not read the directory name for VCs
with repository revision granularity. Adjust the tag/branch
prompt. Reset VC properties.
(vc-retrieve-tag): Do not read the directory name for VCs
with repository revision granularity. Reset VC properties.
Add optional support for resetting VC properties.
* vc-dispatcher.el (vc-resynch-window): Add new optional argument,
call vc-file-clearprops when true.
(vc-resynch-buffer): Add new optional argument, pass it down.
(vc-resynch-buffers-in-directory): Likewise.
Improve support for special markup in the VC commit message.
* vc-mtn.el (vc-mtn-checkin): Support Author: and Date: markup.
* vc-hg.el (vc-hg-checkin): Add support for Date:.
* vc-git.el (vc-git-checkin):
* vc-bzr.el (vc-bzr-checkin): Likewise.
Add support for vc-log-incoming, improve vc-log-outgoing for Git.
* vc-git.el (vc-git-log-view-mode): Fix font lock for
incoming/outgoing logs.
(vc-git-log-outgoing, vc-git-log-incoming): New functions.
* vc-git.el (vc-git-log-outgoing): Use the same format as the
short log.
(vc-git-log-incoming): Likewise. Run "git fetch" before the log
command
Add bindings for vc-log-incoming and vc-log-outgoing.
* vc-hooks.el (vc-prefix-map): Add bindings for vc-log-incoming
and vc-log-outgoing.
* vc-dir.el (vc-dir-menu-map): Add menu bindings for vc-log-incoming
and vc-log-outgoing.
Improve state updating for VC tag commands.
* vc.el (vc-create-tag, vc-retrieve-tag): Call vc-resynch-buffer
to update the state of all buffers in the directory.
2010-05-19 Glenn Morris <rgm@gnu.org>
* vc-dir.el (vc-dir): Don't pop-up-windows. (Bug#6204)
2010-10-31 Stefan Monnier <monnier@iro.umontreal.ca>
* vc.el (vc-checkin, vc-modify-change-comment):
Adjust to new vc-start/finish-logentry.
(vc-find-conflicted-file): New command.
(vc-transfer-file): Adjust to new vc-checkin.
(vc-next-action): Improve scoping.
* vc-git.el (vc-git-checkin): Use log-edit-extract-headers.
(vc-git-commits-coding-system): Rename from git-commits-coding-system.
* vc-dispatcher.el (vc-log-edit): Shorten names for
log-edit-show-files.
* vc-bzr.el (vc-bzr-checkin): Use log-edit-extract-headers.
(vc-bzr-conflicted-files): New function.
* log-edit.el (log-edit-summary, log-edit-header)
(log-edit-unknown-header): New faces.
(log-edit-headers-alist): New var.
(log-edit-header-contents-regexp): New const.
(log-edit-match-to-eoh): New function.
(log-edit-font-lock-keywords): Use them.
(log-edit): Insert a "Summary:" header as default.
(log-edit-mode): Mark font-lock rules as case-insensitive.
(log-edit-done): Cleanup headers.
(log-edit-extract-headers): New function to replace it.
* vc-dispatcher.el (vc-finish-logentry): Don't mess so badly with
the windows/frames.
* vc-bzr.el (vc-bzr-shelve-apply): Don't use *vc-bzr-shelve*.
* vc-dir.el (vc-dir-kill-line): New command.
(vc-dir-mode-map): Bind it to C-k.
(vc-dir-headers): Abbreviate the working dir.
* vc-git.el (vc-git-revision-table): Include remote branches.
2010-10-31 Dan Nicolaescu <dann@ics.uci.edu>
New VC methods: vc-log-incoming and vc-log-outgoing.
* vc.el (vc-print-log-setup-buttons, vc-log-internal-common)
(vc-incoming-outgoing-internal, vc-log-incoming, vc-log-outgoing):
New functions.
(vc-print-log-internal): Just call vc-log-internal-common.
(vc-log-view-type): New permanent local variable.
* vc-hooks.el (vc-menu-map): Bind vc-log-incoming and vc-log-outgoing.
* vc-bzr.el (vc-bzr-log-view-mode): Use vc-log-view-type instead
of the dynamic bound vc-short-log.
(vc-bzr-log-incoming, vc-bzr-log-outgoing): New functions.
* vc-git.el (vc-git-log-outgoing): New function.
(vc-git-log-view-mode): Use vc-log-view-type instead
of the dynamic bound vc-short-log.
* vc-hg.el (vc-hg-log-view-mode): Use vc-log-view-type instead of
the dynamic bound vc-short-log. Highlight the tag.
(vc-hg-log-incoming, vc-hg-log-outgoing): New functions.
(vc-hg-outgoing, vc-hg-incoming, vc-hg-outgoing-mode):
(vc-hg-incoming-mode): Remove.
(vc-hg-extra-menu-map): Do not bind vc-hg-incoming and vc-hg-outgoing.
Fix default-directory for vc-root-diff.
* vc.el (vc-root-diff): Bind default-directory to the root
directory for the diff command.
2010-10-31 Sam Steingold <sds@gnu.org>
* vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling
`vc-hg-command' with a list of flags.
2010-10-31 Glenn Morris <rgm@gnu.org>
* vc-bzr.el (vc-bzr-log-edit-mode): Add --fixes support to
log-edit-before-checkin-process.
* vc.el (vc-modify-change-comment): Pass MODE to vc-start-logentry.
* vc-bzr.el, vc-hg.el (log-edit-mode): Declare.
* vc-dispatcher.el (vc-start-logentry): Doc fix.
(log-view-process-buffer, log-edit-extra-flags): Declare.
2010-10-31 Dan Nicolaescu <dann@ics.uci.edu>
Add special markup processing for commit logs.
* log-edit.el (log-edit): Add new argument MODE. Use that mode
when non-nil instead of the log-view-mode.
* vc.el (vc-default-log-edit-mode): New function.
* vc-dispatcher.el (vc-log-edit): Add a mode argument, pass it to
log-edit.
Support for shelving snapshots and for showing shelves.
* vc-bzr.el (vc-bzr-shelve-show, vc-bzr-shelve-show-at-point)
(vc-bzr-shelve-apply-and-keep-at-point, vc-bzr-shelve-snapshot):
New functions.
(vc-bzr-shelve-map, vc-bzr-shelve-menu-map)
(vc-bzr-extra-menu-map): Map them.
2010-10-30 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-handle-insert-file-contents): For root,
......
......@@ -97,6 +97,9 @@ when editing big diffs)."
:options '(diff-delete-empty-files diff-make-unified)
:group 'diff-mode)
(defvar diff-vc-backend nil
"The VC backend that created the current Diff buffer, if any.")
(defvar diff-outline-regexp
"\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)")
......@@ -138,6 +141,7 @@ when editing big diffs)."
;; Standard M-r is useful, so don't change M-r or M-R.
;;("r" . diff-restrict-view)
;;("R" . diff-reverse-direction)
("g" . revert-buffer)
("q" . quit-window))
"Basic keymap for `diff-mode', bound to various prefix keys.")
......
This diff is collapsed.
......@@ -128,6 +128,7 @@
(easy-mmode-defmap log-view-mode-map
'(("z" . kill-this-buffer)
("q" . quit-window)
("g" . revert-buffer)
("m" . log-view-toggle-mark-entry)
("e" . log-view-modify-change-comment)
("d" . log-view-diff)
......
......@@ -254,8 +254,7 @@ Only the value `maybe' can be trusted :-(."
(buffer-substring (point-min) (1- (point-max)))))))))
(defun vc-arch-workfile-unchanged-p (file)
"Check if FILE is unchanged by diffing against the master version.
Return non-nil if FILE is unchanged."
"Stub: arch workfiles are always considered to be in a changed state,"
nil)
(defun vc-arch-state (file)
......
......@@ -451,11 +451,17 @@ or a superior directory.")
"Unregister FILE from bzr."
(vc-bzr-command "remove" nil 0 file "--keep"))
(declare-function log-edit-extract-headers "log-edit" (headers string))
(defun vc-bzr-checkin (files rev comment)
"Check FILE in to bzr with log message COMMENT.
REV non-nil gets an error."
(if rev (error "Can't check in a specific revision with bzr"))
(vc-bzr-command "commit" nil 0 files "-m" comment))
(apply 'vc-bzr-command "commit" nil 0
files (cons "-m" (log-edit-extract-headers '(("Author" . "--author")
("Date" . "--commit-time")
("Fixes" . "--fixes"))
comment))))
(defun vc-bzr-find-revision (file rev buffer)
"Fetch revision REV of file FILE and put it into BUFFER."
......@@ -478,7 +484,6 @@ REV non-nil gets an error."
(defvar log-view-font-lock-keywords)
(defvar log-view-current-tag-function)
(defvar log-view-per-file-logs)
(defvar vc-short-log)
(define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View"
(remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
......@@ -486,13 +491,13 @@ REV non-nil gets an error."
(set (make-local-variable 'log-view-per-file-logs) nil)
(set (make-local-variable 'log-view-file-re) "\\`a\\`")
(set (make-local-variable 'log-view-message-re)
(if vc-short-log
(if (eq vc-log-view-type 'short)
"^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
"^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)"))
(set (make-local-variable 'log-view-font-lock-keywords)
;; log-view-font-lock-keywords is careful to use the buffer-local
;; value of log-view-message-re only since Emacs-23.
(if vc-short-log
(if (eq vc-log-view-type 'short)
(append `((,log-view-message-re
(1 'log-view-message-face)
(2 'change-log-name)
......@@ -526,6 +531,14 @@ REV non-nil gets an error."
(list vc-bzr-log-switches)
vc-bzr-log-switches)))))
(defun vc-bzr-log-incoming (buffer remote-location)
(apply 'vc-bzr-command "missing" buffer 'async nil
(list "--theirs-only" (unless (string= remote-location "") remote-location))))
(defun vc-bzr-log-outgoing (buffer remote-location)
(apply 'vc-bzr-command "missing" buffer 'async nil
(list "--mine-only" (unless (string= remote-location "") remote-location))))
(defun vc-bzr-show-log-entry (revision)
"Find entry for patch name REVISION in bzr change log buffer."
(goto-char (point-min))
......@@ -758,9 +771,11 @@ stream. Standard error output is discarded."
(define-key map [down-mouse-3] 'vc-bzr-shelve-menu)
(define-key map "\C-k" 'vc-bzr-shelve-delete-at-point)
;; (define-key map "=" 'vc-bzr-shelve-show-at-point)
;; (define-key map "\C-m" 'vc-bzr-shelve-show-at-point)
(define-key map "=" 'vc-bzr-shelve-show-at-point)
(define-key map "\C-m" 'vc-bzr-shelve-show-at-point)
(define-key map "A" 'vc-bzr-shelve-apply-and-keep-at-point)
(define-key map "P" 'vc-bzr-shelve-apply-at-point)
(define-key map "S" 'vc-bzr-shelve-snapshot)
map))
(defvar vc-bzr-shelve-menu-map
......@@ -768,16 +783,22 @@ stream. Standard error output is discarded."
(define-key map [de]
'(menu-item "Delete shelf" vc-bzr-shelve-delete-at-point
:help "Delete the current shelf"))
(define-key map [ap]
'(menu-item "Apply and keep shelf" vc-bzr-shelve-apply-and-keep-at-point
:help "Apply the current shelf and keep it"))
(define-key map [po]
'(menu-item "Apply and remove shelf (pop)" vc-bzr-shelve-apply-at-point
:help "Apply the current shelf and remove it"))
;; (define-key map [sh]
;; '(menu-item "Show shelve" vc-bzr-shelve-show-at-point
;; :help "Show the contents of the current shelve"))
(define-key map [sh]
'(menu-item "Show shelve" vc-bzr-shelve-show-at-point
:help "Show the contents of the current shelve"))
map))
(defvar vc-bzr-extra-menu-map
(let ((map (make-sparse-keymap)))
(define-key map [bzr-sn]
'(menu-item "Shelve a snapshot" vc-bzr-shelve-snapshot
:help "Shelve the current state of the tree and keep the current state"))
(define-key map [bzr-sh]
'(menu-item "Shelve..." vc-bzr-shelve
:help "Shelve changes"))
......@@ -864,21 +885,38 @@ stream. Standard error output is discarded."
(vc-bzr-command "shelve" nil 0 nil "--all" "-m" name)
(vc-resynch-buffer root t t))))
;; (defun vc-bzr-shelve-show (name)
;; "Show the contents of shelve NAME."
;; (interactive "sShelve name: ")
;; (vc-setup-buffer "*vc-bzr-shelve*")
;; ;; FIXME: how can you show the contents of a shelf?
;; (vc-bzr-command "shelve" "*vc-bzr-shelve*" 'async nil name)
;; (set-buffer "*vc-bzr-shelve*")
;; (diff-mode)
;; (setq buffer-read-only t)
;; (pop-to-buffer (current-buffer)))
(defun vc-bzr-shelve-show (name)
"Show the contents of shelve NAME."
(interactive "sShelve name: ")
(vc-setup-buffer "*vc-diff*")
;; FIXME: how can you show the contents of a shelf?
(vc-bzr-command "unshelve" "*vc-diff*" 'async nil "--preview" name)
(set-buffer "*vc-diff*")
(diff-mode)
(setq buffer-read-only t)
(pop-to-buffer (current-buffer)))
(defun vc-bzr-shelve-apply (name)
"Apply shelve NAME and remove it afterwards."
(interactive "sApply (and remove) shelf: ")
(vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" name)
(vc-bzr-command "unshelve" nil 0 nil "--apply" name)
(vc-resynch-buffer (vc-bzr-root default-directory) t t))
(defun vc-bzr-shelve-apply-and-keep (name)
"Apply shelve NAME and keep it afterwards."
(interactive "sApply (and keep) shelf: ")
(vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep" name)
(vc-resynch-buffer (vc-bzr-root default-directory) t t))
(defun vc-bzr-shelve-snapshot ()
"Create a stash with the current tree state."
(interactive)
(vc-bzr-command "shelve" nil 0 nil "--all" "-m"
(let ((ct (current-time)))
(concat
(format-time-string "Snapshot on %Y-%m-%d" ct)
(format-time-string " at %H:%M" ct))))
(vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep")
(vc-resynch-buffer (vc-bzr-root default-directory) t t))
(defun vc-bzr-shelve-list ()
......@@ -905,14 +943,18 @@ stream. Standard error output is discarded."
(vc-bzr-command "unshelve" nil 0 nil "--delete-only" shelve)
(vc-dir-refresh))))
;; (defun vc-bzr-shelve-show-at-point ()
;; (interactive)
;; (vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point))))
(defun vc-bzr-shelve-show-at-point ()
(interactive)
(vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point))))
(defun vc-bzr-shelve-apply-at-point ()
(interactive)
(vc-bzr-shelve-apply (vc-bzr-shelve-get-at-point (point))))
(defun vc-bzr-shelve-apply-and-keep-at-point ()
(interactive)
(vc-bzr-shelve-apply-and-keep (vc-bzr-shelve-get-at-point (point))))
(defun vc-bzr-shelve-menu (e)
(interactive "e")
(vc-dir-at-event e (popup-menu vc-bzr-shelve-menu-map e)))
......@@ -930,6 +972,19 @@ stream. Standard error output is discarded."
(setq loglines (buffer-substring-no-properties start (point-max))))))
vc-bzr-revisions))
(defun vc-bzr-conflicted-files (dir)
(let ((default-directory (vc-bzr-root dir))
(files ()))
(with-temp-buffer
(vc-bzr-command "status" t 0 default-directory)
(goto-char (point-min))
(when (re-search-forward "^conflicts:\n" nil t)
(while (looking-at " \\(?:Text conflict in \\(.*\\)\\|.*\\)\n")
(if (match-end 1)
(push (expand-file-name (match-string 1)) files))
(goto-char (match-end 0)))))
files))
;;; Revision completion
(eval-and-compile
......
......@@ -188,9 +188,18 @@ See `run-hooks'."
(define-key map [diff]
'(menu-item "Compare with Base Version" vc-diff
:help "Compare file set with the base version"))
(define-key map [logo]
'(menu-item "Show Outgoing Log" vc-log-outgoing
:help "Show a log of changes that will be sent with a push operation"))
(define-key map [logi]
'(menu-item "Show Incoming Log" vc-log-incoming
:help "Show a log of changes that will be received with a pull operation"))
(define-key map [log]
'(menu-item "Show history" vc-print-log
:help "List the change log of the current file set in a window"))
'(menu-item "Show history" vc-print-log
:help "List the change log of the current file set in a window"))
(define-key map [rlog]
'(menu-item "Show Top of the Tree History " vc-print-root-log
:help "List the change log for the current tree in a window"))
;; VC commands.
(define-key map [sepvccmd] '("--"))
(define-key map [update]
......@@ -263,6 +272,7 @@ See `run-hooks'."
(define-key map [mouse-2] 'vc-dir-toggle-mark)
(define-key map [follow-link] 'mouse-face)
(define-key map "x" 'vc-dir-hide-up-to-date)
(define-key map [?\C-k] 'vc-dir-kill-line)
(define-key map "S" 'vc-dir-search) ;; FIXME: Maybe use A like dired?
(define-key map "Q" 'vc-dir-query-replace-regexp)
(define-key map (kbd "M-s a C-s") 'vc-dir-isearch)
......@@ -963,7 +973,8 @@ specific headers."
(propertize "VC backend : " 'face 'font-lock-type-face)
(propertize (format "%s\n" backend) 'face 'font-lock-variable-name-face)
(propertize "Working dir: " 'face 'font-lock-type-face)
(propertize (format "%s\n" dir) 'face 'font-lock-variable-name-face)
(propertize (format "%s\n" (abbreviate-file-name dir))
'face 'font-lock-variable-name-face)
;; Then the backend specific ones.
(vc-call-backend backend 'dir-extra-headers dir)
"\n"))
......@@ -1100,6 +1111,13 @@ outside of VC) and one wants to do some operation on it."
(ewoc-delete vc-ewoc crt))
(setq crt prev)))))
(defun vc-dir-kill-line ()
"Remove the current line from display."
(interactive)
(let ((crt (ewoc-locate vc-ewoc))
(inhibit-read-only t))
(ewoc-delete vc-ewoc crt)))
(defun vc-dir-printer (fileentry)
(vc-call-backend vc-dir-backend 'dir-printer fileentry))
......@@ -1169,7 +1187,8 @@ These are the commands available for use in the file status buffer:
nil t nil nil)))))
(unless backend
(setq backend (vc-responsible-backend dir)))
(pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend))
(let (pop-up-windows) ; based on cvs-examine; bug#6204
(pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend)))
(if (derived-mode-p 'vc-dir-mode)
(vc-dir-refresh)
;; FIXME: find a better way to pass the backend to `vc-dir-mode'.
......
......@@ -141,7 +141,6 @@ preserve the setting."
(defvar vc-log-operation nil)
(defvar vc-log-after-operation-hook nil)
(defvar vc-log-fileset)
(defvar vc-log-extra)
;; In a log entry buffer, this is a local variable
;; that points to the buffer for which it was made
......@@ -458,7 +457,7 @@ ARG and NO-CONFIRM are passed on to `revert-buffer'."
(make-variable-buffer-local 'vc-mode-line-hook)
(put 'vc-mode-line-hook 'permanent-local t)
(defun vc-resynch-window (file &optional keep noquery)
(defun vc-resynch-window (file &optional keep noquery reset-vc-info)
"If FILE is in the current buffer, either revert or unvisit it.
The choice between revert (to see expanded keywords) and unvisit
depends on KEEP. NOQUERY if non-nil inhibits confirmation for
......@@ -469,6 +468,8 @@ editing!"
(and (string= buffer-file-name file)
(if keep
(when (file-exists-p file)
(when reset-vc-info
(vc-file-clearprops file))
(vc-revert-buffer-internal t noquery)
;; VC operations might toggle the read-only state. In
......@@ -490,24 +491,24 @@ editing!"
(declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
(declare-function vc-string-prefix-p "vc" (prefix string))
(defun vc-resynch-buffers-in-directory (directory &optional keep noquery)
(defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info)
"Resync all buffers that visit files in DIRECTORY."
(dolist (buffer (buffer-list))
(let ((fname (buffer-file-name buffer)))
(when (and fname (vc-string-prefix-p directory fname))
(with-current-buffer buffer
(vc-resynch-buffer fname keep noquery))))))
(vc-resynch-buffer fname keep noquery reset-vc-info))))))
(defun vc-resynch-buffer (file &optional keep noquery)
(defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
"If FILE is currently visited, resynch its buffer."
(if (string= buffer-file-name file)
(vc-resynch-window file keep noquery)
(vc-resynch-window file keep noquery reset-vc-info)
(if (file-directory-p file)
(vc-resynch-buffers-in-directory file keep noquery)
(vc-resynch-buffers-in-directory file keep noquery reset-vc-info)
(let ((buffer (get-file-buffer file)))
(when buffer
(with-current-buffer buffer
(vc-resynch-window file keep noquery))))))
(vc-resynch-window file keep noquery reset-vc-info))))))
;; Try to avoid unnecessary work, a *vc-dir* buffer is only present
;; if this is true.
(when vc-dir-buffers
......@@ -527,21 +528,26 @@ NOT-URGENT means it is ok to continue if the user says not to save."
;; Set up key bindings for use while editing log messages
(defun vc-log-edit (fileset)
(defun vc-log-edit (fileset mode)
"Set up `log-edit' for use on FILE."
(setq default-directory
(with-current-buffer vc-parent-buffer default-directory))
(log-edit 'vc-finish-logentry
nil
`((log-edit-listfun . (lambda () ',fileset))
(log-edit-diff-function . (lambda () (vc-diff nil)))))
`((log-edit-listfun . (lambda ()
;; FIXME: Should expand the list
;; for directories.
(mapcar 'file-relative-name
',fileset)))
(log-edit-diff-function . (lambda () (vc-diff nil))))
nil
mode)
(set (make-local-variable 'vc-log-fileset) fileset)
(make-local-variable 'vc-log-extra)
(set-buffer-modified-p nil)
(setq buffer-file-name nil))
(defun vc-start-logentry (files extra comment initial-contents msg logbuf action &optional after-hook)
"Accept a comment for an operation on FILES with extra data EXTRA.
(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook)
"Accept a comment for an operation on FILES.
If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
action on close to ACTION. If COMMENT is a string and
INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial
......@@ -549,8 +555,9 @@ contents of the log entry buffer. If COMMENT is a string and
INITIAL-CONTENTS is nil, do action immediately as if the user had
entered COMMENT. If COMMENT is t, also do action immediately with an
empty comment. Remember the file's buffer in `vc-parent-buffer'
\(current one if no file). AFTER-HOOK specifies the local value
for `vc-log-after-operation-hook'."
\(current one if no file). Puts the log-entry buffer in major-mode
MODE, defaulting to `log-edit-mode' if MODE is nil.
AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'."
(let ((parent
(if (vc-dispatcher-browsing)
;; If we are called from a directory browser, the parent buffer is
......@@ -565,12 +572,11 @@ for `vc-log-after-operation-hook'."
(set (make-local-variable 'vc-parent-buffer) parent)
(set (make-local-variable 'vc-parent-buffer-name)
(concat " from " (buffer-name vc-parent-buffer)))
(vc-log-edit files)
(vc-log-edit files mode)
(make-local-variable 'vc-log-after-operation-hook)
(when after-hook
(setq vc-log-after-operation-hook after-hook))
(setq vc-log-operation action)
(setq vc-log-extra extra)
(when comment
(erase-buffer)
(when (stringp comment) (insert comment)))
......@@ -579,7 +585,8 @@ for `vc-log-after-operation-hook'."
(vc-finish-logentry (eq comment t)))))
(declare-function vc-dir-move-to-goal-column "vc-dir" ())
;; vc-finish-logentry is typically called from a log-edit buffer (see
;; vc-start-logentry).
(defun vc-finish-logentry (&optional nocomment)
"Complete the operation implied by the current log entry.
Use the contents of the current buffer as a check-in or registration
......@@ -595,20 +602,21 @@ the buffer contents as a comment."
(or (vc-dispatcher-browsing) (vc-buffer-sync)))
(unless vc-log-operation
(error "No log operation is pending"))
;; save the parameters held in buffer-local variables
(let ((logbuf (current-buffer))
(log-operation vc-log-operation)
;; FIXME: When coming from VC-Dir, we should check that the
;; set of selected files is still equal to vc-log-fileset,
;; to avoid surprises.
(log-fileset vc-log-fileset)
(log-extra vc-log-extra)
(log-entry (buffer-string))
(after-hook vc-log-after-operation-hook)
(tmp-vc-parent-buffer vc-parent-buffer))
(after-hook vc-log-after-operation-hook))
(pop-to-buffer vc-parent-buffer)
;; OK, do it to it
(save-excursion
(funcall log-operation
log-fileset
log-extra
log-entry))
;; Remove checkin window (after the checkin so that if that fails
;; we don't zap the log buffer and the typing therein).
......@@ -617,9 +625,11 @@ the buffer contents as a comment."
(delete-windows-on logbuf (selected-frame))
;; Kill buffer and delete any other dedicated windows/frames.
(kill-buffer logbuf))
(logbuf (pop-to-buffer logbuf)
(bury-buffer)
(pop-to-buffer tmp-vc-parent-buffer)))
(logbuf
(with-selected-window (or (get-buffer-window logbuf 0)
(selected-window))
(with-current-buffer logbuf
(bury-buffer)))))
;; Now make sure we see the expanded headers
(when log-fileset
(mapc
......
......@@ -118,7 +118,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
:version "23.1"
:group 'vc)
(defvar git-commits-coding-system 'utf-8
(defvar vc-git-commits-coding-system 'utf-8
"Default coding system for git commits.")
;;; BACKEND PROPERTIES
......@@ -171,7 +171,14 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(defun vc-git-state (file)
"Git-specific version of `vc-state'."
;; FIXME: This can't set 'ignored yet
;; FIXME: This can't set 'ignored or 'conflict yet
;; The 'ignored state could be detected with `git ls-files -i -o
;; --exclude-standard` It also can't set 'needs-update or
;; 'needs-merge. The rough equivalent would be that upstream branch
;; for current branch is in fast-forward state i.e. current branch
;; is direct ancestor of corresponding upstream branch, and the file
;; was modified upstream. But we can't check that without a network
;; operation.
(if (not (vc-git-registered file))
'unregistered
(vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
......@@ -541,11 +548,16 @@ or an empty string if none."