comparison lisp/vc/vc-bzr.el @ 111685:411dce7ee068

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.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 23 Nov 2010 10:13:43 -0500
parents 33ed3cf8260b
children 4b2ef298966a
comparison
equal deleted inserted replaced
111684:280ee0988e1a 111685:411dce7ee068
254 is the root of the current Bzr branch. Display the buffer in 254 is the root of the current Bzr branch. Display the buffer in
255 some window, but don't select it." 255 some window, but don't select it."
256 ;; TODO: set up hyperlinks. 256 ;; TODO: set up hyperlinks.
257 (let* ((dir default-directory) 257 (let* ((dir default-directory)
258 (root (vc-bzr-root default-directory)) 258 (root (vc-bzr-root default-directory))
259 (buffer (get-buffer-create (format "*vc-bzr : %s*" root)))) 259 (buffer (get-buffer-create
260 (format "*vc-bzr : %s*"
261 (expand-file-name root)))))
260 (with-current-buffer buffer 262 (with-current-buffer buffer
261 (setq default-directory root) 263 (setq default-directory root)
262 (goto-char (point-max)) 264 (goto-char (point-max))
263 (unless (eq (point) (point-min)) 265 (unless (eq (point) (point-min))
264 (insert " \n")) 266 (insert " \n"))
286 (parent (unless bound 288 (parent (unless bound
287 (string-match 289 (string-match
288 "^parent_location\\s-*=\\s-*[^\n[:space:]]+" 290 "^parent_location\\s-*=\\s-*[^\n[:space:]]+"
289 branch-conf))) 291 branch-conf)))
290 (command (if bound "update" "pull")) 292 (command (if bound "update" "pull"))
291 args buf) 293 args)
292 ;; If necessary, prompt for the exact command. 294 ;; If necessary, prompt for the exact command.
293 (when (or prompt (not (or bound parent))) 295 (when (or prompt (not (or bound parent)))
294 (setq args (split-string 296 (setq args (split-string
295 (read-shell-command 297 (read-shell-command
296 "Run Bzr (like this): " 298 "Run Bzr (like this): "
300 (setq vc-bzr-program (car args) 302 (setq vc-bzr-program (car args)
301 command (cadr args) 303 command (cadr args)
302 args (cddr args))) 304 args (cddr args)))
303 (vc-bzr-async-command command args))) 305 (vc-bzr-async-command command args)))
304 306
305 (defun vc-bzr-merge-branch (prompt) 307 (defun vc-bzr-merge-branch ()
306 "Merge another Bzr branch into the current one. 308 "Merge another Bzr branch into the current one.
307 If a default merge source is defined (i.e. an upstream branch or 309 Prompt for the Bzr command to run, providing a pre-defined merge
308 a previous merge source), this normally runs \"bzr merge --pull\". 310 source (an upstream branch or a previous merge source) as a
309 If optional PROMPT is non-nil or no default merge source is 311 default if it is available."
310 defined, prompt for the Bzr command to run." 312 (let* ((branch-conf (vc-bzr--branch-conf default-directory))
311 (let* ((vc-bzr-program vc-bzr-program) 313 ;; "bzr merge" without an argument defaults to submit_branch,
312 (command "merge") 314 ;; then parent_location. We extract the specific location
313 (args '("--pull")) 315 ;; and add it explicitly to the command line.
314 command-string args buf) 316 (location
315 (when (or prompt 317 (cond
316 ;; Prompt if there is no default merge source. 318 ((string-match
317 (null 319 "^submit_branch\\s-*=\\s-*\\(?:file://\\)?\\([^\n[:space:]]+\\)$"
318 (string-match 320 branch-conf)
319 "^\\(parent_location\\|submit_branch\\)\\s-*=\\s-*[^\n[:space:]]+" 321 (match-string 1 branch-conf))
320 (vc-bzr--branch-conf default-directory)))) 322 ((string-match
321 (setq args (split-string 323 "^parent_location\\s-*=\\s-*\\(?:file://\\)?\\([^\n[:space:]]+\\)$"
322 (read-shell-command 324 branch-conf)
323 "Run Bzr (like this): " 325 (match-string 1 branch-conf))))
324 (concat vc-bzr-program " " command " --pull") 326 (cmd
325 'vc-bzr-history) 327 (split-string
326 " " t)) 328 (read-shell-command
327 (setq vc-bzr-program (car args) 329 "Run Bzr (like this): "
328 command (cadr args) 330 (concat vc-bzr-program " merge --pull"
329 args (cddr args))) 331 (if location (concat " " location) ""))
332 'vc-bzr-history)
333 " " t))
334 (vc-bzr-program (car cmd))
335 (command (cadr cmd))
336 (args (cddr cmd)))
330 (vc-bzr-async-command command args))) 337 (vc-bzr-async-command command args)))
331 338
332 (defun vc-bzr-status (file) 339 (defun vc-bzr-status (file)
333 "Return FILE status according to Bzr. 340 "Return FILE status according to Bzr.
334 Return value is a cons (STATUS . WARNING), where WARNING is a 341 Return value is a cons (STATUS . WARNING), where WARNING is a