emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102485: Always issue a full prompt i


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102485: Always issue a full prompt in vc-merge-branch operation.
Date: Tue, 23 Nov 2010 10:13:43 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102485
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Tue 2010-11-23 10:13:43 -0500
message:
  Always issue a full prompt in vc-merge-branch operation.
  
  * vc/vc.el (vc-merge): Remove optional arg PROMPT.  Always prompt
  for a merge location.
  
  * vc/vc-bzr.el (vc-bzr-pull): Remove unused var.
  (vc-bzr-merge-branch): Always prompt.
  (vc-bzr-async-command): Use the full branch filename.
modified:
  lisp/ChangeLog
  lisp/vc/vc-bzr.el
  lisp/vc/vc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-11-23 14:19:54 +0000
+++ b/lisp/ChangeLog    2010-11-23 15:13:43 +0000
@@ -1,3 +1,12 @@
+2010-11-23  Chong Yidong  <address@hidden>
+
+       * vc/vc.el (vc-merge): Remove optional arg PROMPT.  Always prompt
+       for a merge location.
+
+       * vc/vc-bzr.el (vc-bzr-pull): Remove unused var.
+       (vc-bzr-merge-branch): Always prompt.
+       (vc-bzr-async-command): Use the full branch filename.
+
 2010-11-23  Stefan Monnier  <address@hidden>
 
        * shell.el (shell): Use current-buffer by default if it's already

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2010-11-23 01:15:08 +0000
+++ b/lisp/vc/vc-bzr.el 2010-11-23 15:13:43 +0000
@@ -256,7 +256,9 @@
   ;; TODO: set up hyperlinks.
   (let* ((dir default-directory)
         (root (vc-bzr-root default-directory))
-        (buffer (get-buffer-create (format "*vc-bzr : %s*" root))))
+        (buffer (get-buffer-create
+                 (format "*vc-bzr : %s*"
+                         (expand-file-name root)))))
     (with-current-buffer buffer
       (setq default-directory root)
       (goto-char (point-max))
@@ -288,7 +290,7 @@
                    "^parent_location\\s-*=\\s-*[^\n[:space:]]+"
                    branch-conf)))
         (command (if bound "update" "pull"))
-        args buf)
+        args)
     ;; If necessary, prompt for the exact command.
     (when (or prompt (not (or bound parent)))
       (setq args (split-string
@@ -302,31 +304,36 @@
            args           (cddr args)))
     (vc-bzr-async-command command args)))
 
-(defun vc-bzr-merge-branch (prompt)
+(defun vc-bzr-merge-branch ()
   "Merge another Bzr branch into the current one.
-If a default merge source is defined (i.e. an upstream branch or
-a previous merge source), this normally runs \"bzr merge --pull\".
-If optional PROMPT is non-nil or no default merge source is
-defined, prompt for the Bzr command to run."
-  (let* ((vc-bzr-program vc-bzr-program)
-        (command "merge")
-        (args '("--pull"))
-        command-string args buf)
-    (when (or prompt
-             ;; Prompt if there is no default merge source.
-             (null
-              (string-match
-               
"^\\(parent_location\\|submit_branch\\)\\s-*=\\s-*[^\n[:space:]]+"
-               (vc-bzr--branch-conf default-directory))))
-      (setq args (split-string
-                 (read-shell-command
-                  "Run Bzr (like this): "
-                  (concat vc-bzr-program " " command " --pull")
-                  'vc-bzr-history)
-                 " " t))
-      (setq vc-bzr-program (car  args)
-           command        (cadr args)
-           args           (cddr args)))
+Prompt for the Bzr command to run, providing a pre-defined merge
+source (an upstream branch or a previous merge source) as a
+default if it is available."
+  (let* ((branch-conf (vc-bzr--branch-conf default-directory))
+        ;; "bzr merge" without an argument defaults to submit_branch,
+        ;; then parent_location.  We extract the specific location
+        ;; and add it explicitly to the command line.
+        (location
+         (cond
+          ((string-match
+            "^submit_branch\\s-*=\\s-*\\(?:file://\\)?\\([^\n[:space:]]+\\)$"
+            branch-conf)
+           (match-string 1 branch-conf))
+          ((string-match
+            "^parent_location\\s-*=\\s-*\\(?:file://\\)?\\([^\n[:space:]]+\\)$"
+            branch-conf)
+           (match-string 1 branch-conf))))
+        (cmd
+         (split-string
+          (read-shell-command
+           "Run Bzr (like this): "
+           (concat vc-bzr-program " merge --pull"
+                   (if location (concat " " location) ""))
+           'vc-bzr-history)
+          " " t))
+        (vc-bzr-program (car  cmd))
+        (command        (cadr cmd))
+        (args           (cddr cmd)))
     (vc-bzr-async-command command args)))
 
 (defun vc-bzr-status (file)

=== modified file 'lisp/vc/vc.el'
--- a/lisp/vc/vc.el     2010-11-23 01:15:08 +0000
+++ b/lisp/vc/vc.el     2010-11-23 15:13:43 +0000
@@ -316,10 +316,10 @@
 ;;   Merge the changes between REV1 and REV2 into the current working file
 ;;   (for non-distributed VCS).
 ;;
-;; - merge-branch (prompt)
+;; - merge-branch ()
 ;;
-;;   Merge another branch into the current one.  If PROMPT is non-nil,
-;;   or if necessary, prompt for a location to merge from.
+;;   Merge another branch into the current one, prompting for a
+;;   location to merge from.
 ;;
 ;; - merge-news (file)
 ;;
@@ -1828,12 +1828,11 @@
                           'modify-change-comment files rev comment))))))
 
 ;;;###autoload
-(defun vc-merge (&optional arg)
+(defun vc-merge ()
   "Perform a version control merge operation.
 On a distributed version control system, this runs a \"merge\"
 operation to incorporate changes from another branch onto the
-current branch, prompting for an argument list if required.
-Optional prefix ARG forces a prompt.
+current branch, prompting for an argument list.
 
 On a non-distributed version control system, this merges changes
 between two revisions into the current fileset.  This asks for
@@ -1841,14 +1840,14 @@
 revision is a branch number, then merge all changes from that
 branch.  If the first revision is empty, merge the most recent
 changes from the current branch."
-  (interactive "P")
+  (interactive)
   (let* ((vc-fileset (vc-deduce-fileset t))
         (backend (car vc-fileset))
         (files (cadr vc-fileset)))
     (cond
      ;; If a branch-merge operation is defined, use it.
      ((vc-find-backend-function backend 'merge-branch)
-      (vc-call-backend backend 'merge-branch arg))
+      (vc-call-backend backend 'merge-branch))
      ;; Otherwise, do a per-file merge.
      ((vc-find-backend-function backend 'merge)
       (vc-buffer-sync)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]