* vc-pull/vc-push support
@ 2010-05-25 7:06 Dan Nicolaescu
2010-05-25 7:43 ` Miles Bader
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Dan Nicolaescu @ 2010-05-25 7:06 UTC (permalink / raw)
To: emacs-devel
This has been sitting on my disk for quite a while, and did not see much progress :-(
vc-pull/vc-push without any options work for bzr, but that's about it.
Maybe someone would find this useful and want to help finish the implementation...
=== modified file 'lisp/log-view.el'
=== modified file 'lisp/vc-bzr.el'
--- lisp/vc-bzr.el 2010-04-21 02:10:50 +0000
+++ lisp/vc-bzr.el 2010-05-22 20:27:23 +0000
@@ -478,6 +478,18 @@
(unless contents-done
(with-temp-buffer (vc-bzr-command "revert" t 0 file))))
+(defun vc-bzr-pull (revision remote-location)
+ (apply 'vc-bzr-command "pull" t 1 nil
+ (append
+ (when revision (list "-r" revision))
+ (when remote-location (list remote-location)))))
+
+(defun vc-bzr-push (revision remote-location)
+ (apply 'vc-bzr-command "push" t 1 nil
+ (append
+ (when revision (list "-r" revision))
+ (when remote-location (list remote-location)))))
+
(defvar log-view-message-re)
(defvar log-view-file-re)
(defvar log-view-font-lock-keywords)
=== modified file 'lisp/vc.el'
--- lisp/vc.el 2010-04-21 02:05:24 +0000
+++ lisp/vc.el 2010-04-22 08:14:22 +0000
@@ -336,6 +336,14 @@
;; Mark conflicts as resolved. Some VC systems need to run a
;; command to mark conflicts as resolved.
;;
+;; - pull (revision remote-location)
+;;
+;; Experimental support for the pull operation in modern VCS.
+;;
+;; - push (revision remote-location)
+;;
+;; Experimental support for the push operation in modern VCS.
+;;
;; HISTORY FUNCTIONS
;;
;; * print-log (files buffer &optional shortlog start-revision limit)
@@ -1925,6 +1933,46 @@
'retrieve-tag dir name update)
(message "%s" (concat msg "done"))))
+
+;;;#autoload
+(defun vc-pull (revision remote-location)
+ "EXPERIMENTAL support for the PULL operation.
+WARNING: this just runs the VC backend command, it does not try to do any bookkeeping."
+ (interactive
+ (if current-prefix-arg
+ (list
+ (read-string "Revision (empty for latest): ")
+ (read-string "Remote location (empty for default): "))
+ (list nil nil)))
+ (let ((backend
+ (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
+ ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
+ (vc-mode (vc-backend buffer-file-name))))
+ rootdir working-revision)
+ (unless backend
+ (error "Buffer is not version controlled"))
+ (vc-call-backend backend 'pull revision remote-location)))
+
+;;;#autoload
+(defun vc-push (revision remote-location)
+ "EXPERIMENTAL support for the PUSH operation.
+WARNING: this just runs the VC backend command, it does not try to do any bookkeeping."
+ (interactive
+ (if current-prefix-arg
+ (list
+ (read-string "Revision (empty for latest): ")
+ (read-string "Remote location (empty for default): "))
+ (list nil nil)))
+ (let ((backend
+ (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
+ ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
+ (vc-mode (vc-backend buffer-file-name))))
+ rootdir working-revision)
+ (unless backend
+ (error "Buffer is not version controlled"))
+ (vc-call-backend backend 'push revision remote-location)))
+
+
;; Miscellaneous other entry points
;; FIXME: this should be a defcustom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: vc-pull/vc-push support
2010-05-25 7:06 vc-pull/vc-push support Dan Nicolaescu
@ 2010-05-25 7:43 ` Miles Bader
2010-05-25 7:48 ` Dan Nicolaescu
2010-05-25 9:37 ` Uday S Reddy
2010-05-25 9:45 ` Ævar Arnfjörð Bjarmason
2 siblings, 1 reply; 5+ messages in thread
From: Miles Bader @ 2010-05-25 7:43 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
Dan Nicolaescu <dann@gnu.org> writes:
> +;; - pull (revision remote-location)
What does it mean to "pull" a particular revision? Is the revision in
the local namespace or the remote namespace?
-Miles
--
Kilt, n. A costume sometimes worn by Scotchmen [sic] in America and Americans
in Scotland.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: vc-pull/vc-push support
2010-05-25 7:43 ` Miles Bader
@ 2010-05-25 7:48 ` Dan Nicolaescu
0 siblings, 0 replies; 5+ messages in thread
From: Dan Nicolaescu @ 2010-05-25 7:48 UTC (permalink / raw)
To: Miles Bader; +Cc: emacs-devel
Miles Bader <miles@gnu.org> writes:
> Dan Nicolaescu <dann@gnu.org> writes:
>> +;; - pull (revision remote-location)
>
> What does it mean to "pull" a particular revision?
Pull all revisions up to REVI
> Is the revision in the local namespace or the remote namespace?
Remote.
The intended use-case for this is to do M-x vc-log-incoming and
then be able to select what to pull. (assuming this is useful...)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: vc-pull/vc-push support
2010-05-25 7:06 vc-pull/vc-push support Dan Nicolaescu
2010-05-25 7:43 ` Miles Bader
@ 2010-05-25 9:37 ` Uday S Reddy
2010-05-25 9:45 ` Ævar Arnfjörð Bjarmason
2 siblings, 0 replies; 5+ messages in thread
From: Uday S Reddy @ 2010-05-25 9:37 UTC (permalink / raw)
To: emacs-devel
On 5/25/2010 8:06 AM, Dan Nicolaescu wrote:
>
> This has been sitting on my disk for quite a while, and did not see much progress :-(
> vc-pull/vc-push without any options work for bzr, but that's about it.
> Maybe someone would find this useful and want to help finish the implementation...
Hi Dan, many thanks for doing this. It will be quite helpful.
When I tried it on Windows XP, it hung the Emacs session. Some timeouts and failure recovery might be needed. My bazaar installation is:
Bazaar (bzr) 2.1.0
Python interpreter: C:\program files\Bazaar\python25.dll 2.5.4
Python standard library: C:\program files\Bazaar\lib\library.zip
Platform: Windows-XP-5.1.2600-SP3
bzrlib: C:\program files\Bazaar\lib\library.zip\bzrlib
Cheers,
Uday
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: vc-pull/vc-push support
2010-05-25 7:06 vc-pull/vc-push support Dan Nicolaescu
2010-05-25 7:43 ` Miles Bader
2010-05-25 9:37 ` Uday S Reddy
@ 2010-05-25 9:45 ` Ævar Arnfjörð Bjarmason
2 siblings, 0 replies; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-05-25 9:45 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
On Tue, May 25, 2010 at 07:06, Dan Nicolaescu <dann@gnu.org> wrote:
> This has been sitting on my disk for quite a while, and did not see much progress :-(
> vc-pull/vc-push without any options work for bzr, but that's about it.
> Maybe someone would find this useful and want to help finish the implementation...
These are some hacky enhancements I used to pull/push with Git +
vc. I've now removed them from my ~/.emacs since I use magit. But
perhaps they'll be nice for reference.
They allow you to push with C-u C-x v p, and pull with C-x v p.
;; This could be made portable but I'm not interested in that at the
;; moment so it's git-only.
(defun vc-push-or-pull ()
"`vc-push' if given an argument, otherwise `vc-pull'"
(interactive)
(if current-prefix-arg
(vc-push)
(vc-pull)))
(defun vc-push ()
"Run git-push on the current repository, does a dry-run unless
given a prefix arg."
(interactive)
(shell-command "git push"))
(defun vc-pull ()
"Run git-pull on the current repository."
(interactive)
(shell-command "git pull"))
;; vc.el - add commands to push and pull with git
(progn
(define-key vc-prefix-map "p" 'vc-push-or-pull))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-25 9:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 7:06 vc-pull/vc-push support Dan Nicolaescu
2010-05-25 7:43 ` Miles Bader
2010-05-25 7:48 ` Dan Nicolaescu
2010-05-25 9:37 ` Uday S Reddy
2010-05-25 9:45 ` Ævar Arnfjörð Bjarmason
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.