/[emacs]/emacs/lisp/vc.el
ViewVC logotype

Diff of /emacs/lisp/vc.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.318 by spiegel, Fri Nov 9 14:55:52 2001 UTC revision 1.319 by sds, Mon Nov 12 23:01:17 2001 UTC
# Line 90  Line 90 
90  ;; return it; it should not look it up in the property, and it needn't  ;; return it; it should not look it up in the property, and it needn't
91  ;; store it there either.  However, if a backend-specific function does  ;; store it there either.  However, if a backend-specific function does
92  ;; store a value in a property, that value takes precedence over any  ;; store a value in a property, that value takes precedence over any
93  ;; value that the generic code might want to set (check for uses of  ;; value that the generic code might want to set (check for uses of
94  ;; the macro `with-vc-properties' in vc.el).  ;; the macro `with-vc-properties' in vc.el).
95  ;;  ;;
96  ;; In the list of functions below, each identifier needs to be prepended  ;; In the list of functions below, each identifier needs to be prepended
# Line 103  Line 103 
103  ;;  ;;
104  ;;   Return non-nil if FILE is registered in this backend.  ;;   Return non-nil if FILE is registered in this backend.
105  ;;  ;;
106  ;; * state (file)  ;; * state (file)
107  ;;  ;;
108  ;;   Return the current version control state of FILE.  For a list of  ;;   Return the current version control state of FILE.  For a list of
109  ;;   possible values, see `vc-state'.  This function should do a full and  ;;   possible values, see `vc-state'.  This function should do a full and
# Line 296  Line 296 
296  ;;   found), or 1 (either non-empty diff or the diff is run  ;;   found), or 1 (either non-empty diff or the diff is run
297  ;;   asynchronously).  ;;   asynchronously).
298  ;;  ;;
299  ;; - diff-tree (dir &optional rev1 rev2)  ;; - diff-tree (dir &optional rev1 rev2)
300  ;;  ;;
301  ;;   Insert the diff for all files at and below DIR into the *vc-diff*  ;;   Insert the diff for all files at and below DIR into the *vc-diff*
302  ;;   buffer.  The meaning of REV1 and REV2 is the same as for  ;;   buffer.  The meaning of REV1 and REV2 is the same as for
303  ;;   vc-BACKEND-diff.  The default implementation does an explicit tree  ;;   vc-BACKEND-diff.  The default implementation does an explicit tree
304  ;;   walk, calling vc-BACKEND-diff for each individual file.  ;;   walk, calling vc-BACKEND-diff for each individual file.
305  ;;  ;;
# Line 564  version control backend imposes itself." Line 564  version control backend imposes itself."
564      (300. . "#00EEFF")      (300. . "#00EEFF")
565      (320. . "#00B6FF")      (320. . "#00B6FF")
566      (340. . "#007EFF"))      (340. . "#007EFF"))
567    "*ASSOCIATION list of age versus color, for \\[vc-annotate].      "*ASSOCIATION list of age versus color, for \\[vc-annotate].
568  Ages are given in units of fractional days.  Default is eighteen steps  Ages are given in units of fractional days.  Default is eighteen steps
569  using a twenty day increment."  using a twenty day increment."
570    :type 'alist    :type 'alist
# Line 1061  NOT-URGENT means it is ok to continue if Line 1061  NOT-URGENT means it is ok to continue if
1061    (zerop (vc-call diff file (vc-workfile-version file))))    (zerop (vc-call diff file (vc-workfile-version file))))
1062    
1063  (defun vc-default-latest-on-branch-p (backend file)  (defun vc-default-latest-on-branch-p (backend file)
1064    "Default check whether the current workfile version of FILE is the    "Default check whether the current workfile version of FILE is the
1065  latest on its branch."  latest on its branch."
1066    t)    t)
1067    
# Line 1832  actually call the backend, but performs Line 1832  actually call the backend, but performs
1832        (vc-call diff file rel1 rel2))))        (vc-call diff file rel1 rel2))))
1833    
1834  (defmacro vc-diff-switches-list (backend)  (defmacro vc-diff-switches-list (backend)
1835    "Make a list of `diff-switches', `vc-diff-switches',    "Make a list of `diff-switches', `vc-diff-switches',
1836  and `vc-BACKEND-diff-switches'."  and `vc-BACKEND-diff-switches'."
1837    `(append    `(append
1838      (if (listp diff-switches) diff-switches (list diff-switches))      (if (listp diff-switches) diff-switches (list diff-switches))
1839      (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches))      (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches))
1840      (let ((backend-switches      (let ((backend-switches
1841             (eval (intern (concat "vc-" (symbol-name ',backend)             (eval (intern (concat "vc-" (symbol-name ',backend)
1842                                   "-diff-switches")))))                                   "-diff-switches")))))
1843        (if (listp backend-switches) backend-switches (list backend-switches)))))        (if (listp backend-switches) backend-switches (list backend-switches)))))
1844    
1845  (defun vc-default-diff-tree (backend dir rel1 rel2)  (defun vc-default-diff-tree (backend dir rel1 rel2)
1846    "Default implementation for diffing an entire tree at and below DIR.    "Default implementation for diffing an entire tree at and below DIR.
1847  The meaning of REL1 and REL2 is the same as for `vc-version-diff'."  The meaning of REL1 and REL2 is the same as for `vc-version-diff'."
1848    ;; This implementation does an explicit tree walk, and calls    ;; This implementation does an explicit tree walk, and calls
1849    ;; vc-BACKEND-diff directly for each file.  An optimization    ;; vc-BACKEND-diff directly for each file.  An optimization
1850    ;; would be to use `vc-diff-internal', so that diffs can be local,    ;; would be to use `vc-diff-internal', so that diffs can be local,
1851    ;; and to call it only for files that are actually changed.    ;; and to call it only for files that are actually changed.
# Line 1856  The meaning of REL1 and REL2 is the same Line 1856  The meaning of REL1 and REL2 is the same
1856     default-directory     default-directory
1857     (lambda (f)     (lambda (f)
1858       (vc-exec-after       (vc-exec-after
1859        `(let ((coding-system-for-read (vc-coding-system-for-diff ',f)))        `(let ((coding-system-for-read (vc-coding-system-for-diff ',f)))
1860           (message "Looking at %s" ',f)           (message "Looking at %s" ',f)
1861           (vc-call-backend ',(vc-backend f)           (vc-call-backend ',(vc-backend f)
1862                            'diff ',f ',rel1 ',rel2))))))                            'diff ',f ',rel1 ',rel2))))))
1863    
1864  (defun vc-coding-system-for-diff (file)  (defun vc-coding-system-for-diff (file)
1865    "Return the coding system for reading diff output for FILE."    "Return the coding system for reading diff output for FILE."
1866    (or coding-system-for-read    (or coding-system-for-read
1867        ;; if we already have this file open,        ;; if we already have this file open,
1868        ;; use the buffer's coding system        ;; use the buffer's coding system
1869        (let ((buf (find-buffer-visiting file)))        (let ((buf (find-buffer-visiting file)))
1870          (if buf (with-current-buffer buf          (if buf (with-current-buffer buf
# Line 2438  allowed and simply skipped)." Line 2438  allowed and simply skipped)."
2438      (pop-to-buffer (current-buffer))      (pop-to-buffer (current-buffer))
2439      (if (fboundp 'log-view-mode) (log-view-mode))      (if (fboundp 'log-view-mode) (log-view-mode))
2440      (vc-exec-after      (vc-exec-after
2441       `(progn       `(let ((inhibit-read-only t))
2442          (goto-char (point-max)) (forward-line -1)          (goto-char (point-max)) (forward-line -1)
2443          (while (looking-at "=*\n")          (while (looking-at "=*\n")
2444            (delete-char (- (match-end 0) (match-beginning 0)))            (delete-char (- (match-end 0) (match-beginning 0)))
# Line 2453  allowed and simply skipped)." Line 2453  allowed and simply skipped)."
2453            (if (vc-find-backend-function ',(vc-backend file) 'show-log-entry)            (if (vc-find-backend-function ',(vc-backend file) 'show-log-entry)
2454                (vc-call-backend ',(vc-backend file)                (vc-call-backend ',(vc-backend file)
2455                                 'show-log-entry                                 'show-log-entry
2456                                 ',(vc-workfile-version file))))))))                                 ',(vc-workfile-version file))))
2457            (set-buffer-modified-p nil)))))
2458    
2459  (defun vc-default-comment-history (backend file)  (defun vc-default-comment-history (backend file)
2460    "Return a string with all log entries that were made under BACKEND for FILE."    "Return a string with all log entries that were made under BACKEND for FILE."
# Line 2883  menu items." Line 2884  menu items."
2884  colormap by RATIO, if present.  Use the current time as offset."  colormap by RATIO, if present.  Use the current time as offset."
2885    (interactive "e")    (interactive "e")
2886    (message "Redisplaying annotation...")    (message "Redisplaying annotation...")
2887    (vc-annotate-display    (vc-annotate-display
2888     (if ratio (vc-annotate-time-span vc-annotate-color-map ratio)))     (if ratio (vc-annotate-time-span vc-annotate-color-map ratio)))
2889    (message "Redisplaying annotation...done"))    (message "Redisplaying annotation...done"))
2890    
# Line 2908  cover the full time range, from oldest t Line 2909  cover the full time range, from oldest t
2909      (vc-annotate-display      (vc-annotate-display
2910       (vc-annotate-time-span             ;return the scaled colormap.       (vc-annotate-time-span             ;return the scaled colormap.
2911        vc-annotate-color-map        vc-annotate-color-map
2912        (/ (-  (if full newest current) oldest)        (/ (-  (if full newest current) oldest)
2913           (vc-annotate-car-last-cons vc-annotate-color-map)))           (vc-annotate-car-last-cons vc-annotate-color-map)))
2914       (if full newest))       (if full newest))
2915      (message "Redisplaying annotation...done \(%s\)"      (message "Redisplaying annotation...done \(%s\)"
2916               (if full               (if full
2917                   (format "Spanned from %.1f to %.1f days old"                   (format "Spanned from %.1f to %.1f days old"
2918                           (- current oldest)                           (- current oldest)
2919                           (- current newest))                           (- current newest))
2920                 (format "Spanned to %.1f days old" (- current oldest))))))                 (format "Spanned to %.1f days old" (- current oldest))))))
# Line 2933  cover the full time range, from oldest t Line 2934  cover the full time range, from oldest t
2934        (let* ((element (car menu-elements))        (let* ((element (car menu-elements))
2935               (days (* element oldest-in-map)))               (days (* element oldest-in-map)))
2936          (setq menu-elements (cdr menu-elements))          (setq menu-elements (cdr menu-elements))
2937          (setq menu-def          (setq menu-def
2938                (append menu-def                (append menu-def
2939                        `([,(format "Span %.1f days" days)                        `([,(format "Span %.1f days" days)
2940                           (unless (and (numberp vc-annotate-display-mode)                           (unless (and (numberp vc-annotate-display-mode)
2941                                        (= vc-annotate-display-mode ,days))                                        (= vc-annotate-display-mode ,days))
2942                             (vc-annotate-display-select nil ,days))                             (vc-annotate-display-select nil ,days))
2943                           :style toggle :selected                           :style toggle :selected
2944                           (and (numberp vc-annotate-display-mode)                           (and (numberp vc-annotate-display-mode)
2945                                (= vc-annotate-display-mode ,days)) ])))))                                (= vc-annotate-display-mode ,days)) ])))))
2946      (setq menu-def      (setq menu-def
2947            (append menu-def            (append menu-def
2948                    (list                    (list
2949                     ["Span ..."                     ["Span ..."
2950                      (let ((days                      (let ((days
2951                             (float (string-to-number                             (float (string-to-number
2952                                     (read-string "Span how many days? ")))))                                     (read-string "Span how many days? ")))))
2953                        (vc-annotate-display-select nil days)) t])                        (vc-annotate-display-select nil days)) t])
2954                    (list "--")                    (list "--")
2955                    (list                    (list
2956                     ["Span to Oldest"                     ["Span to Oldest"
2957                      (unless (eq vc-annotate-display-mode 'scale)                      (unless (eq vc-annotate-display-mode 'scale)
2958                        (vc-annotate-display-select nil 'scale))                        (vc-annotate-display-select nil 'scale))
2959                      :style toggle :selected                      :style toggle :selected
2960                      (eq vc-annotate-display-mode 'scale)])                      (eq vc-annotate-display-mode 'scale)])
2961                    (list                    (list
2962                     ["Span Oldest->Newest"                     ["Span Oldest->Newest"
2963                      (unless (eq vc-annotate-display-mode 'fullscale)                      (unless (eq vc-annotate-display-mode 'fullscale)
2964                        (vc-annotate-display-select nil 'fullscale))                        (vc-annotate-display-select nil 'fullscale))
2965                      :style toggle :selected                      :style toggle :selected
2966                      (eq vc-annotate-display-mode 'fullscale)])))                      (eq vc-annotate-display-mode 'fullscale)])))
2967      ;; Define the menu      ;; Define the menu
2968      (if (or (featurep 'easymenu) (load "easymenu" t))      (if (or (featurep 'easymenu) (load "easymenu" t))
2969          (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map          (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
2970                            "VC Annotate Display Menu" menu-def))))                            "VC Annotate Display Menu" menu-def))))
2971    
2972  (defun vc-annotate-display-select (&optional buffer mode)  (defun vc-annotate-display-select (&optional buffer mode)
# Line 2978  customizable variable `vc-annotate-displ Line 2979  customizable variable `vc-annotate-displ
2979      (display-buffer buffer))      (display-buffer buffer))
2980    (if (not vc-annotate-mode)            ; Turn on vc-annotate-mode if not done    (if (not vc-annotate-mode)            ; Turn on vc-annotate-mode if not done
2981        (vc-annotate-mode))        (vc-annotate-mode))
2982    (cond ((null vc-annotate-display-mode) (vc-annotate-display-default    (cond ((null vc-annotate-display-mode) (vc-annotate-display-default
2983                                            vc-annotate-ratio))                                            vc-annotate-ratio))
2984          ((symbolp vc-annotate-display-mode) ; One of the auto-scaling modes          ((symbolp vc-annotate-display-mode) ; One of the auto-scaling modes
2985           (cond ((eq vc-annotate-display-mode 'scale)           (cond ((eq vc-annotate-display-mode 'scale)
2986                  (vc-annotate-display-autoscale))                  (vc-annotate-display-autoscale))
2987                 ((eq vc-annotate-display-mode 'fullscale)                 ((eq vc-annotate-display-mode 'fullscale)
2988                  (vc-annotate-display-autoscale t))                  (vc-annotate-display-autoscale t))
2989                 (t (error "No such display mode: %s"                 (t (error "No such display mode: %s"
2990                           vc-annotate-display-mode))))                           vc-annotate-display-mode))))
2991          ((numberp vc-annotate-display-mode) ; A fixed number of days lookback          ((numberp vc-annotate-display-mode) ; A fixed number of days lookback
2992           (vc-annotate-display-default           (vc-annotate-display-default
2993            (/ vc-annotate-display-mode (vc-annotate-car-last-cons            (/ vc-annotate-display-mode (vc-annotate-car-last-cons
2994                                         vc-annotate-color-map))))                                         vc-annotate-color-map))))
2995          (t (error "Error in display mode select"))))          (t (error "Error in display mode select"))))
2996    
# Line 3028  colors. `vc-annotate-background' specifi Line 3029  colors. `vc-annotate-background' specifi
3029    (let* ((temp-buffer-name (concat "*Annotate " (buffer-name) "*"))    (let* ((temp-buffer-name (concat "*Annotate " (buffer-name) "*"))
3030           (temp-buffer-show-function 'vc-annotate-display-select)           (temp-buffer-show-function 'vc-annotate-display-select)
3031           (rev (vc-workfile-version (buffer-file-name)))           (rev (vc-workfile-version (buffer-file-name)))
3032           (vc-annotate-version           (vc-annotate-version
3033            (if prefix (read-string            (if prefix (read-string
3034                        (format "Annotate from version: (default %s) " rev)                        (format "Annotate from version: (default %s) " rev)
3035                        nil nil rev)                        nil nil rev)
3036              rev)))              rev)))
3037      (if prefix      (if prefix
3038          (setq vc-annotate-display-mode          (setq vc-annotate-display-mode
3039                (float (string-to-number                (float (string-to-number
3040                        (read-string "Annotate span days: (default 20) "                        (read-string "Annotate span days: (default 20) "
3041                                     nil nil "20")))))                                     nil nil "20")))))
3042      (setq vc-annotate-backend (vc-backend (buffer-file-name)))      (setq vc-annotate-backend (vc-backend (buffer-file-name)))
3043      (message "Annotating...")      (message "Annotating...")
# Line 3098  time returned from the backend function Line 3099  time returned from the backend function
3099  set, use it as the time base instead of the current time."  set, use it as the time base instead of the current time."
3100     (let ((next-time (vc-call-backend vc-annotate-backend 'annotate-time)))     (let ((next-time (vc-call-backend vc-annotate-backend 'annotate-time)))
3101       (if next-time       (if next-time
3102           (- (or offset           (- (or offset
3103                  (vc-call-backend vc-annotate-backend 'annotate-current-time))                  (vc-call-backend vc-annotate-backend 'annotate-current-time))
3104              next-time))))              next-time))))
3105    
3106  (defun vc-default-annotate-current-time (backend)  (defun vc-default-annotate-current-time (backend)
3107    "Return the current time, encoded as fractional days."    "Return the current time, encoded as fractional days."
3108    (vc-annotate-convert-time (current-time)))    (vc-annotate-convert-time (current-time)))
3109      
3110  (defun vc-annotate-display (&optional color-map offset)  (defun vc-annotate-display (&optional color-map offset)
3111    "Do the VC-Annotate display in BUFFER using COLOR-MAP, and time    "Do the VC-Annotate display in BUFFER using COLOR-MAP, and time
3112  offset OFFSET (defaults to the present time).  You probably want  offset OFFSET (defaults to the present time).  You probably want
# Line 3133  offset OFFSET (defaults to the present t Line 3134  offset OFFSET (defaults to the present t
3134                       (let ((tmp-face (make-face (intern face-name))))                       (let ((tmp-face (make-face (intern face-name))))
3135                         (set-face-foreground tmp-face (cdr color))                         (set-face-foreground tmp-face (cdr color))
3136                         (if vc-annotate-background                         (if vc-annotate-background
3137                               (set-face-background tmp-face                               (set-face-background tmp-face
3138                                                    vc-annotate-background))                                                    vc-annotate-background))
3139                         tmp-face)))      ; Return the face                         tmp-face)))      ; Return the face
3140             (point (point))             (point (point))

Legend:
Removed from v.1.318  
changed lines
  Added in v.1.319

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26