Mercurial > emacs
comparison lisp/vc-bzr.el @ 96002:26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 16 Jun 2008 08:53:27 +0000 |
parents | 054335cbee3d |
children | d5ad6b6af42d |
comparison
equal
deleted
inserted
replaced
96001:b41affc105cf | 96002:26f719e36c03 |
---|---|
211 (defun vc-bzr-file-name-relative (filename) | 211 (defun vc-bzr-file-name-relative (filename) |
212 "Return file name FILENAME stripped of the initial Bzr repository path." | 212 "Return file name FILENAME stripped of the initial Bzr repository path." |
213 (lexical-let* | 213 (lexical-let* |
214 ((filename* (expand-file-name filename)) | 214 ((filename* (expand-file-name filename)) |
215 (rootdir (vc-bzr-root filename*))) | 215 (rootdir (vc-bzr-root filename*))) |
216 (when rootdir | 216 (when rootdir |
217 (file-relative-name filename* rootdir)))) | 217 (file-relative-name filename* rootdir)))) |
218 | 218 |
219 (defun vc-bzr-status (file) | 219 (defun vc-bzr-status (file) |
220 "Return FILE status according to Bzr. | 220 "Return FILE status according to Bzr. |
221 Return value is a cons (STATUS . WARNING), where WARNING is a | 221 Return value is a cons (STATUS . WARNING), where WARNING is a |
323 (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir))) | 323 (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir))) |
324 ;; This looks at internal files to avoid forking a bzr process. | 324 ;; This looks at internal files to avoid forking a bzr process. |
325 ;; May break if they change their format. | 325 ;; May break if they change their format. |
326 (if (file-exists-p branch-format-file) | 326 (if (file-exists-p branch-format-file) |
327 (with-temp-buffer | 327 (with-temp-buffer |
328 (insert-file-contents branch-format-file) | 328 (insert-file-contents branch-format-file) |
329 (goto-char (point-min)) | 329 (goto-char (point-min)) |
330 (cond | 330 (cond |
331 ((or | 331 ((or |
332 (looking-at "Bazaar-NG branch, format 0.0.4") | 332 (looking-at "Bazaar-NG branch, format 0.0.4") |
333 (looking-at "Bazaar-NG branch format 5")) | 333 (looking-at "Bazaar-NG branch format 5")) |
334 ;; count lines in .bzr/branch/revision-history | 334 ;; count lines in .bzr/branch/revision-history |
335 (insert-file-contents revhistory-file) | 335 (insert-file-contents revhistory-file) |
336 (number-to-string (count-lines (line-end-position) (point-max)))) | 336 (number-to-string (count-lines (line-end-position) (point-max)))) |
337 ((looking-at "Bazaar Branch Format 6 (bzr 0.15)") | 337 ((looking-at "Bazaar Branch Format 6 (bzr 0.15)") |
338 ;; revno is the first number in .bzr/branch/last-revision | 338 ;; revno is the first number in .bzr/branch/last-revision |
339 (insert-file-contents lastrev-file) | 339 (insert-file-contents lastrev-file) |
340 (if (re-search-forward "[0-9]+" nil t) | 340 (if (re-search-forward "[0-9]+" nil t) |
341 (buffer-substring (match-beginning 0) (match-end 0)))))) | 341 (buffer-substring (match-beginning 0) (match-end 0)))))) |
342 ;; fallback to calling "bzr revno" | 342 ;; fallback to calling "bzr revno" |
343 (lexical-let* | 343 (lexical-let* |
344 ((result (vc-bzr-command-discarding-stderr | 344 ((result (vc-bzr-command-discarding-stderr |
421 | 421 |
422 (defvar log-view-message-re) | 422 (defvar log-view-message-re) |
423 (defvar log-view-file-re) | 423 (defvar log-view-file-re) |
424 (defvar log-view-font-lock-keywords) | 424 (defvar log-view-font-lock-keywords) |
425 (defvar log-view-current-tag-function) | 425 (defvar log-view-current-tag-function) |
426 (defvar log-view-per-file-logs) | |
426 | 427 |
427 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" | 428 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" |
428 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. | 429 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. |
429 (require 'add-log) | 430 (require 'add-log) |
430 (set (make-local-variable 'log-view-per-file-logs) nil) | 431 (set (make-local-variable 'log-view-per-file-logs) nil) |
467 "Find entry for patch name REVISION in bzr change log buffer." | 468 "Find entry for patch name REVISION in bzr change log buffer." |
468 (goto-char (point-min)) | 469 (goto-char (point-min)) |
469 (let (case-fold-search) | 470 (let (case-fold-search) |
470 (if (re-search-forward | 471 (if (re-search-forward |
471 ;; "revno:" can appear either at the beginning of a line, or indented. | 472 ;; "revno:" can appear either at the beginning of a line, or indented. |
472 (concat "^[ ]*-+\n[ ]*revno: " | 473 (concat "^[ ]*-+\n[ ]*revno: " |
473 ;; The revision can contain ".", quote it so that it | 474 ;; The revision can contain ".", quote it so that it |
474 ;; does not interfere with regexp matching. | 475 ;; does not interfere with regexp matching. |
475 (regexp-quote revision) "$") nil t) | 476 (regexp-quote revision) "$") nil t) |
476 (beginning-of-line 0) | 477 (beginning-of-line 0) |
477 (goto-char (point-min))))) | 478 (goto-char (point-min))))) |
478 | 479 |
479 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) | 480 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) |
480 "VC bzr backend for diff." | 481 "VC bzr backend for diff." |
481 ;; `bzr diff' exits with code 1 if diff is non-empty. | 482 ;; `bzr diff' exits with code 1 if diff is non-empty. |
482 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 'async files | 483 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 'async files |
483 "--diff-options" (mapconcat 'identity | 484 "--diff-options" (mapconcat 'identity |
484 (vc-diff-switches-list bzr) | 485 (vc-diff-switches-list bzr) |
485 " ") | 486 " ") |
486 ;; This `when' is just an optimization because bzr-1.2 is *much* | 487 ;; This `when' is just an optimization because bzr-1.2 is *much* |
487 ;; faster when the revision argument is not given. | 488 ;; faster when the revision argument is not given. |
488 (when (or rev1 rev2) | 489 (when (or rev1 rev2) |
489 (list "-r" (format "%s..%s" | 490 (list "-r" (format "%s..%s" |
490 (or rev1 "revno:-1") | 491 (or rev1 "revno:-1") |
491 (or rev2 "")))))) | 492 (or rev2 "")))))) |
492 | 493 |
493 | 494 |
494 ;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with | 495 ;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with |
495 ;; straight integer revisions. | 496 ;; straight integer revisions. |
566 (buffer-substring (point-min) (point-max))))) | 567 (buffer-substring (point-min) (point-max))))) |
567 | 568 |
568 (defun vc-bzr-prettify-state-info (file) | 569 (defun vc-bzr-prettify-state-info (file) |
569 "Bzr-specific version of `vc-prettify-state-info'." | 570 "Bzr-specific version of `vc-prettify-state-info'." |
570 (if (eq 'edited (vc-state file)) | 571 (if (eq 'edited (vc-state file)) |
571 (concat "(" (symbol-name (or (vc-file-getprop file 'vc-bzr-state) | 572 (concat "(" (symbol-name (or (vc-file-getprop file 'vc-bzr-state) |
572 'edited)) ")") | 573 'edited)) ")") |
573 ;; else fall back to default vc.el representation | 574 ;; else fall back to default vc.el representation |
574 (vc-default-prettify-state-info 'Bzr file))) | 575 (vc-default-prettify-state-info 'Bzr file))) |
575 | 576 |
576 ;; XXX: this needs testing, it's probably incomplete. | 577 ;; XXX: this needs testing, it's probably incomplete. |
577 (defun vc-bzr-after-dir-status (update-function) | 578 (defun vc-bzr-after-dir-status (update-function) |
578 (let ((status-str nil) | 579 (let ((status-str nil) |
579 (translation '(("+N" . added) | 580 (translation '(("+N" . added) |
580 ("-D" . removed) | 581 ("-D" . removed) |
581 (" M" . edited) | 582 (" M" . edited) |
606 (entry (assoc file result))) | 607 (entry (assoc file result))) |
607 (when entry | 608 (when entry |
608 (setf (nth 1 entry) 'conflict))) | 609 (setf (nth 1 entry) 'conflict))) |
609 (push (list (buffer-substring-no-properties | 610 (push (list (buffer-substring-no-properties |
610 (+ (point) 4) | 611 (+ (point) 4) |
611 (line-end-position)) | 612 (line-end-position)) |
612 translated) result)) | 613 translated) result)) |
613 (forward-line)) | 614 (forward-line)) |
614 (funcall update-function result))) | 615 (funcall update-function result))) |
615 | 616 |
616 (defun vc-bzr-dir-status (dir update-function) | 617 (defun vc-bzr-dir-status (dir update-function) |