1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
|
This is an autogenerated patch header for a single-debian-patch file. The
delta against upstream is either kept as a single patch, or maintained
in some VCS, and exported as a single patch instead of more manageable
atomic patches.
--- emacs-fossil-2020.09.20.orig/vc-fossil.el
+++ emacs-fossil-2020.09.20/vc-fossil.el
@@ -3,102 +3,114 @@
;; Author: Venkat Iyer <venkat@comit.com>
;; vc-fossil.el free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; vc-fossil.el is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
+
+;; vc-fossil.el is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
;; For a copy of the license, please see <http://www.gnu.org/licenses/>.
-
;;; Commentary:
;; This file contains a VC backend for the fossil version control
;; system.
-;;; Installation:
+;;; Todo:
-;; 1. Install this vc-fossil package.
-;; 2. Add "Fossil" to the list of VC backends using
-;; M-x customize-variable vc-handled-backends
-
-;; Alternative manual installation
-;; 1. Put this file somewhere in the Emacs load-path.
-;; 2. Tell Emacs to load it when needed:
-;; (autoload 'vc-fossil-registered "vc-fossil")
-;; 3. Add Fossil to the list of supported backends:
-;; (add-to-list 'vc-handled-backends 'Fossil t)
+;; 1) Implement the rest of the vc interface. See the comment at the
+;; beginning of vc.el. The current status is:
-;;; Implemented Functions
+;; FUNCTION NAME STATUS
;; BACKEND PROPERTIES
-;; * revision-granularity
+;; * revision-granularity OK
+;; - update-on-retrieve-tag OK
;; STATE-QUERYING FUNCTIONS
-;; * registered (file)
-;; * state (file) - 'up-to-date 'edited 'needs-patch 'needs-merge
-;; * dir-status-files (dir files uf)
-;; * workfile-version (file)
-;; * checkout-model (file)
-;; - workfile-unchanged-p (file)
-;; - root (file)
+;; * registered (file) OK
+;; * state (file) OK
+;; - dir-status-files (dir files update-function) OK
+;; - dir-extra-headers (dir) OK
+;; - dir-printer (fileinfo) ??
+;; - status-fileinfo-extra (file) ??
+;; * working-revision (file) OK
+;; * checkout-model (files) OK
+;; - mode-line-string (file) ??
;; STATE-CHANGING FUNCTIONS
-;; * register (file &optional rev comment)
-;; * checkin (file comment &optional rev)
-;; * find-version (file rev buffer)
-;; * checkout (file &optional editable rev)
-;; * revert (file &optional contents-done)
-;; * pull (prompt)
-;; - push (prompt)
-;; - responsible-p (file)
+;; * create-repo () OK
+;; * register (files &optional comment) OK
+;; - responsible-p (file) OK
+;; - receive-file (file rev) ??
+;; - unregister (file) OK
+;; * checkin (files comment &optional rev) OK
+;; * find-revision (file rev buffer) OK
+;; * checkout (file &optional rev) OK
+;; * revert (file &optional contents-done) OK
+;; - merge-file (file &optional rev1 rev2) ??
+;; - merge-branch () ??
+;; - merge-news (file) ??
+;; - pull (prompt) OK
+;; ? push (prompt) OK
+;; - steal-lock (file &optional revision) ??
+;; - modify-change-comment (files rev comment) ??
+;; - mark-resolved (files) ??
+;; - find-admin-dir (file) ??
;; HISTORY FUNCTIONS
-;; * print-log (file &optional buffer)
-;; * diff (file &optional rev1 rev2 buffer async)
+;; * print-log (files buffer &optional shortlog start-revision limit) OK
+;; * log-outgoing (buffer remote-location) ??
+;; * log-incoming (buffer remote-location) ??
+;; - log-search (buffer pattern) ??
+;; - log-view-mode () OK
+;; - show-log-entry (revision) ??
+;; - comment-history (file) ??
+;; - update-changelog (files) ??
+;; * diff (files &optional rev1 rev2 buffer async) OK
+;; - revision-completion-table (files) ??
+;; - annotate-command (file buf &optional rev) OK
+;; - annotate-time () OK
+;; - annotate-current-time () ??
+;; - annotate-extract-revision-at-line () OK
+;; - region-history (file buffer lfrom lto) ??
+;; - region-history-mode () ??
+;; - mergebase (rev1 &optional rev2) ??
+;; TAG SYSTEM
+;; - create-tag (dir name branchp) OK
+;; - retrieve-tag (dir name update) OK
;; MISCELLANEOUS
-;; - delete-file (file)
-;; - rename-file (old new)
+;; - make-version-backups-p (file) ??
+;; - root (file) OK
+;; - ignore (file &optional directory remove) ??
+;; - ignore-completion-table (directory) ??
+;; - previous-revision (file rev) OK
+;; - next-revision (file rev) OK
+;; - log-edit-mode () ??
+;; - check-headers () ??
+;; - delete-file (file) OK
+;; - rename-file (old new) OK
+;; - find-file-hook () ??
+;; - extra-menu () ??
+;; - extra-dir-menu () ??
+;; - conflicted-files (dir) ??
;;; Code:
-(eval-when-compile (require 'vc))
+(eval-when-compile
+ (require 'vc))
(autoload 'vc-switches "vc")
-;;; Customization
-
-(defgroup vc-fossil nil
- "VC Fossil backend."
- :group 'vc)
-
-(defcustom vc-fossil-diff-switches t ; Fossil doesn't support common args like -u
- "String or list of strings specifying switches for Fossil diff under VC.
-If nil, use the value of `vc-diff-switches'. If t, use no switches."
- :type '(choice (const :tag "Unspecified" nil)
- (const :tag "None" t)
- (string :tag "Argument String")
- (repeat :tag "Argument List" :value ("") string))
- :group 'vc-fossil)
-
-(defcustom vc-fossil-extra-header-fields (list :checkout :tags)
- "A list of keywords denoting extra header fields to show in the vc-dir buffer."
- :type '(set (const :repository) (const :remote-url) (const :synchro)
- (const :checkout) (const :comment) (const :tags))
- :group 'vc-fossil)
-
-
-;;; BACKEND PROPERTIES
-
-(defvar vc-fossil-history nil)
-
-(defvar vc-fossil-pull-history nil)
-(defvar vc-fossil-push-history nil)
+(declare-function log-edit-extract-headers "log-edit" (headers string))
-(defun vc-fossil-revision-granularity () 'repository)
+(autoload 'vc-setup-buffer "vc-dispatcher")
+(declare-function vc-compilation-mode "vc-dispatcher" (backend))
+(declare-function vc-exec-after "vc-dispatcher" (code))
+(declare-function vc-set-async-update "vc-dispatcher" (process-buffer))
+(declare-function vc-annotate-convert-time "vc-annotate" (time))
-;; Internal Commands
+;; Internal Functions
(defun vc-fossil--call (buffer &rest args)
(apply #'process-file "fossil" nil buffer nil args))
@@ -107,308 +119,314 @@ If nil, use the value of `vc-diff-switch
(zerop (apply #'vc-fossil--call '(t nil) args)))
(defun vc-fossil--run (&rest args)
- "Run a fossil command and return its output as a string"
(catch 'bail
(with-output-to-string
(with-current-buffer standard-output
- (unless (apply #'vc-fossil--out-ok args)
- (throw 'bail nil))))))
+ (unless (apply #'vc-fossil--out-ok args)
+ (throw 'bail nil))))))
(defun vc-fossil--command (buffer okstatus file-or-list &rest flags)
- "A wrapper around `vc-do-command' for use in vc-fossil.el.
- The difference to vc-do-command is that this function always invokes `fossil'."
(apply #'vc-do-command (or buffer "*vc*") okstatus "fossil" file-or-list flags)
- (when (eql major-mode 'vc-dir-mode) ; update header info
+ (when (eql major-mode 'vc-dir-mode) ; Update header info.
(revert-buffer (current-buffer))))
-(defun vc-fossil--get-id (dir)
- (let* ((default-directory dir)
- (info (vc-fossil--run "info"))
- (pos (string-match "checkout: *\\([0-9a-fA-F]+\\)" info))
- (uid (match-string 1 info))
- )
- (substring uid 0 10)))
-
-(defun vc-fossil--get-repository (dir)
- (let* ((default-directory dir)
- (info (vc-fossil--run "info")))
- (string-match "repository: *\\(.*\\)$" info)
- (match-string 1 info)))
+(defvar vc-fossil--history nil)
(defun vc-fossil--do-async-prompted-command (command &optional prompt hist-var)
- "Run a fossil command asynchronously.
-Allow user to edit command in minibuffer if PROMPT is non-nil."
(let* ((root (vc-fossil-root default-directory))
- (buffer (format "*vc-fossil : %s*" (expand-file-name root)))
- (fossil-program "fossil")
- (args '()))
+ (buffer (format "*vc-fossil : %s*" (expand-file-name root)))
+ (fossil-program "fossil")
+ (args '()))
(when prompt
(setq args (split-string
- (read-shell-command "Run Fossil (like this): "
- (concat fossil-program " " command)
- (or hist-var 'vc-fossil-history))
- " " t))
+ (read-shell-command "Run Fossil (like this): "
+ (concat fossil-program " " command)
+ (or hist-var 'vc-fossil--history))
+ " " t))
(setq fossil-program (car args)
- command (cadr args)
- args (cddr args)))
+ command (cadr args)
+ args (cddr args)))
(apply 'vc-do-async-command buffer root fossil-program command args)
(with-current-buffer buffer
(vc-run-delayed (vc-compilation-mode 'Fossil)))
(vc-set-async-update buffer)))
-;;; STATE-QUERYING FUNCTIONS
+(defun vc-fossil--get-id (dir)
+ (let* ((default-directory dir)
+ (info (vc-fossil--run "info"))
+ (pos (string-match "checkout: *\\([0-9a-fA-F]+\\)" info))
+ (uid (match-string 1 info)))
+ (substring uid 0 10)))
+
+(defun vc-fossil--state-code (code)
+ (cond ((not code) 'unregistered)
+ ((string= code "UNKNOWN") 'unregistered)
+ ((string= code "UNCHANGED") 'up-to-date)
+ ((string= code "CONFLICT") 'conflict)
+ ((string= code "ADDED") 'added)
+ ((string= code "ADD") 'needs-update)
+ ((string= code "EDITED") 'edited)
+ ((string= code "REMOVE") 'removed)
+ ((string= code "UPDATE") 'needs-update)
+ ((string= code "UPDATED_BY_MERGE") 'needs-merge)
+ ((string= code "EXTRA") 'unregistered)
+ ((string= code "MISSING") 'missing)
+ ((string= code "RENAMED") 'added)
+ (t nil)))
+
+(defvar vc-fossil--file-classifications nil
+ "An alist of (filename . classification) pairs.")
+
+(defun vc-fossil--classify-all-files (dir)
+ (setq vc-fossil--file-classifications nil)
+ (let* ((default-directory dir)
+ (lines (split-string (vc-fossil--run "changes" "--classify" "--all" ".") "[\n\r]+" t)))
+ (dolist (line lines)
+ (let* ((state-and-file (split-string-and-unquote line))
+ (state (car state-and-file))
+ (file (cadr state-and-file))
+ (pair (cons file state)))
+ (push pair vc-fossil--file-classifications)))))
+
+(defun vc-fossil--propertize-header-line (name value)
+ (concat (propertize name 'face 'font-lock-type-face)
+ (propertize value 'face 'font-lock-variable-name-face)))
+
+;; Customization
+
+(defgroup vc-fossil nil
+ "VC Fossil backend."
+ :group 'vc)
+
+(defcustom vc-fossil-diff-switches t
+ "String or list of strings specifying switches for Fossil diff under VC.
+If nil, use the value of `vc-diff-switches'. If t, use no switches."
+ :type '(choice (const :tag "Unspecified" nil)
+ (const :tag "None" t)
+ (string :tag "Argument String")
+ (repeat :tag "Argument List" :value ("") string))
+ :group 'vc-fossil)
+
+(defcustom vc-fossil-extra-header-fields (list :repository :remote-url :checkout :tags)
+ "A list of keywords denoting extra header fields to show in the vc-dir buffer."
+ :type '(set (const :repository) (const :remote-url) (const :synchro)
+ (const :checkout) (const :comment) (const :tags))
+ :group 'vc-fossil)
+
+;; BACKEND PROPERTIES
+
+(defun vc-fossil-revision-granularity () 'repository)
+
+(defun vc-fossil-update-on-retrieve-tag () nil)
+
+;; STATE-QUERYING FUNCTIONS
;;;###autoload
(defun vc-fossil-registered (file)
- "Check whether FILE is registered with fossil."
(with-temp-buffer
(let* ((str (ignore-errors
- (vc-fossil--out-ok "finfo" "-s" (file-truename file))
- (buffer-string))))
+ (vc-fossil--out-ok "finfo" "-s" (file-truename file))
+ (buffer-string))))
(and str
- (> (length str) 7)
- (not (string= (substring str 0 7) "unknown"))))))
+ (> (length str) 7)
+ (not (string= (substring str 0 7) "unknown"))))))
-(defun vc-fossil-state-code (code)
- (cond ((not code) 'unregistered)
- ((string= code "UNKNOWN") 'unregistered)
- ((string= code "UNCHANGED") 'up-to-date)
- ((string= code "CONFLICT") 'edited)
- ((string= code "ADDED") 'added)
- ((string= code "ADD") 'needs-update)
- ((string= code "EDITED") 'edited)
- ((string= code "REMOVE") 'removed)
- ((string= code "UPDATE") 'needs-update)
- ((string= code "MERGE") 'needs-merge)
- ((string= code "EXTRA") 'unregistered)
- ((string= code "MISSING") 'missing)
- ((string= code "RENAMED") 'added)
- (t nil)))
-
-(defun vc-fossil-state (file)
- "Fossil specific version of `vc-state'."
- (let* ((line (vc-fossil--run "update" "-n" "-v" "current" (file-truename file)))
- (state (vc-fossil-state-code (car (split-string line)))))
- ;; if 'fossil update' says file is UNCHANGED check to see if it has been RENAMED
+(defun vc-fossil-state (file)
+ (let* ((line (vc-fossil--run "changes" "--classify" "--all" (file-truename file)))
+ (state (vc-fossil--state-code (car (split-string line)))))
+ ;; ---!!! Does 'fossil update' and 'fossil changes' have different
+ ;; ---!!! semantics here?
+ ;;;
+ ;; If 'fossil update' says file is UNCHANGED check to see if it
+ ;; has been RENAMED.
(when (or (not state) (eql state 'up-to-date))
(let ((line (vc-fossil--run "changes" "--classify" "--unchanged" "--renamed"
- (file-truename file))))
- (setq state (and line (vc-fossil-state-code (car (split-string line)))))))
+ (file-truename file))))
+ (setq state (and line (vc-fossil--state-code (car (split-string line)))))))
state))
-(defun vc-fossil-working-revision (file)
- "Fossil Specific version of `vc-working-revision'."
- (let ((line (vc-fossil--run "finfo" "-s" (file-truename file))))
- (and line
- (cadr (split-string line)))))
-
-(defun vc-fossil-workfile-unchanged-p (file)
- (eq 'up-to-date (vc-fossil-state file)))
-
-(defun vc-fossil-root (file)
- (or (vc-find-root file ".fslckout")
- (vc-find-root file "_FOSSIL_")))
-
-;; TODO: mode-line-string
-;; TODO: dir-printer
-
-(defun vc-fossil-dir-status (dir update-function)
- "Get fossil status for all files in a directory"
- (vc-fossil--dir-status-files dir nil update-function))
-
-(defvar vc-fossil--file-classifications nil
- "An alist of (filename . classification) pairs.")
-
-(defun vc-fossil--classify-all-files (dir)
- (setq vc-fossil--file-classifications nil)
- (let* ((default-directory dir)
- (lines (split-string (vc-fossil--run "changes" "--classify" "--all") "[\n\r]+" t)))
- (dolist (line lines)
- (string-match "^\\(\\w+\\)\\s-+\\(.+\\)$" line)
- (let ((pair (cons (match-string 2 line) (match-string 1 line))))
- (push pair vc-fossil--file-classifications)))))
-
-(defun vc-fossil--dir-status-files (dir files update-function)
- "Get fossil status for all specified files in a directory.
-If `files` is nil return the status for all files."
+(defun vc-fossil-dir-status-files (dir files update-function)
(vc-fossil--classify-all-files dir)
- (insert (apply 'vc-fossil--run "update" "-n" "-v" "current"
- (or files (list dir))))
+ (insert (apply 'vc-fossil--run "changes" "--classify" "--all"
+ (or files (list dir))))
(let ((result '())
- (root (vc-fossil-root dir)))
+ (root (vc-fossil-root dir)))
(goto-char (point-min))
(while (not (eobp))
(let* ((line (buffer-substring-no-properties (point) (line-end-position)))
- (status-word (car (split-string line))))
- (if (string-match "-----" status-word)
- (goto-char (point-max))
- (let ((file (substring line (+ (length status-word) 1)))
- (state (vc-fossil-state-code status-word)))
- (setq file (expand-file-name file root))
- (setq file (file-relative-name file dir))
- ;; if 'fossil update' says file is UNCHANGED check to see if it has been RENAMED
- (when (or (not state) (eql state 'up-to-date))
- (setq state (vc-fossil-state-code (cdr (assoc file vc-fossil--file-classifications)))))
- (push (list file state) result)))
- (forward-line)))
- ;; now collect untracked files
+ (status-word (car (split-string line))))
+ (if (string-match "-----" status-word)
+ (goto-char (point-max))
+ (let ((file (cadr (split-string line)))
+ (state (vc-fossil--state-code status-word)))
+ ;; If 'fossil update' says file is UNCHANGED check to see
+ ;; if it has been RENAMED.
+ (when (or (not state) (eql state 'up-to-date))
+ (setq state (vc-fossil--state-code (cdr (assoc file vc-fossil--file-classifications)))))
+ (when (not (eq state 'up-to-date))
+ (push (list file state) result))))
+ (forward-line)))
+ ;; Now collect untracked files.
(delete-region (point-min) (point-max))
- (insert (apply 'vc-fossil--run "extras" "--dotfiles" (or files (list dir))))
+ (insert (apply 'vc-fossil--run "extras" "--dotfiles" (list dir)))
(goto-char (point-min))
(while (not (eobp))
(let ((file (buffer-substring-no-properties (point) (line-end-position))))
- (setq file (expand-file-name file dir))
- (setq file (file-relative-name file dir))
- (push (list file (vc-fossil-state-code nil)) result)
- (forward-line)))
+ (push (list file (vc-fossil--state-code nil)) result)
+ (forward-line)))
(funcall update-function result nil)))
-(if (>= emacs-major-version 25)
- (defun vc-fossil-dir-status-files (dir files update-function)
- (vc-fossil--dir-status-files dir files update-function))
- (defun vc-fossil-dir-status-files (dir files default-state update-function)
- (vc-fossil--dir-status-files dir files update-function)))
-
-(defun vc-fossil-checkout-model (files) 'implicit)
-
-(defun vc-fossil--propertize-header-line (name value)
- (concat (propertize name 'face 'font-lock-type-face)
- (propertize value 'face 'font-lock-variable-name-face)))
-
(defun vc-fossil-dir-extra-headers (dir)
(let ((info (vc-fossil--run "info"))
- (settings (vc-fossil--run "settings"))
- (lines nil))
+ (settings (vc-fossil--run "settings"))
+ (lines nil))
(dolist (field vc-fossil-extra-header-fields)
(unless (null lines)
- (push "\n" lines))
+ (push "\n" lines))
(cond ((eql field :repository)
- (string-match "repository: *\\(.*\\)$" info)
- (let ((repo (match-string 1 info)))
- (push (vc-fossil--propertize-header-line "Repository : " repo) lines)))
- ((eql field :remote-url)
- (let ((remote-url (car (split-string (vc-fossil--run "remote-url")))))
- (push (vc-fossil--propertize-header-line "Remote URL : " remote-url) lines)))
- ((eql field :synchro)
- (let* ((as-match (string-match "^autosync +.+ +\\([[:graph:]]+\\)$" settings))
- (autosync (and as-match (match-string 1 settings)))
- (dp-match (string-match "^dont-push +.+ +\\([[:graph:]]+\\)$" settings))
- (dontpush (and dp-match (match-string 1 settings))))
- (push (vc-fossil--propertize-header-line "Synchro : "
- (concat (and autosync "autosync=") autosync
- (and dontpush " dont-push=") dontpush))
- lines)))
- ((eql field :checkout)
- (let* ((posco (string-match "checkout: *\\([0-9a-fA-F]+\\) \\([-0-9: ]+ UTC\\)" info))
- (coid (substring (match-string 1 info) 0 10))
- (cots (format-time-string "%Y-%m-%d %H:%M:%S %Z"
- (safe-date-to-time (match-string 2 info))))
- (child-match (string-match "child: *\\(.*\\)$" info))
- (leaf (if child-match "non-leaf" "leaf")))
- (push (vc-fossil--propertize-header-line "Checkout : "
- (concat coid " " cots
- (concat " (" leaf ")")))
- lines)))
- ((eql field :comment)
- (string-match "comment: *\\(.*\\)$" info)
- (let ((msg (match-string 1 info)))
- (push (vc-fossil--propertize-header-line "Comment : " msg) lines)))
- ((eql field :tags)
- (string-match "tags: *\\(.*\\)" info)
- (let ((tags (match-string 1 info)))
- (push (vc-fossil--propertize-header-line "Tags : " tags) lines)))))
+ (string-match "repository: *\\(.*\\)$" info)
+ (let ((repo (match-string 1 info)))
+ (push (vc-fossil--propertize-header-line "Repository : " repo) lines)))
+ ((eql field :remote-url)
+ (let ((remote-url (car (split-string (vc-fossil--run "remote-url")))))
+ (unless (string= "off" remote-url)
+ (push (vc-fossil--propertize-header-line "Remote : " remote-url) lines))))
+ ((eql field :synchro)
+ (let* ((as-match (string-match "^autosync +.+ +\\([[:graph:]]+\\)$" settings))
+ (autosync (and as-match (match-string 1 settings)))
+ (dp-match (string-match "^dont-push +.+ +\\([[:graph:]]+\\)$" settings))
+ (dontpush (and dp-match (match-string 1 settings))))
+ (push (vc-fossil--propertize-header-line "Synchro : "
+ (concat (and autosync "autosync=") autosync
+ (and dontpush " dont-push=") dontpush))
+ lines)))
+ ((eql field :checkout)
+ (let* ((posco (string-match "checkout: *\\([0-9a-fA-F]+\\) \\([-0-9: ]+ UTC\\)" info))
+ (coid (substring (match-string 1 info) 0 10))
+ (cots (format-time-string "%Y-%m-%d %H:%M:%S %Z"
+ (safe-date-to-time (match-string 2 info))))
+ (child-match (string-match "child: *\\(.*\\)$" info))
+ (leaf (if child-match "non-leaf" "leaf")))
+ (push (vc-fossil--propertize-header-line "Checkout : "
+ (concat coid " " cots
+ (concat " (" leaf ")")))
+ lines)))
+ ((eql field :comment)
+ (string-match "comment: *\\(.*\\)$" info)
+ (let ((msg (match-string 1 info)))
+ (push (vc-fossil--propertize-header-line "Comment : " msg) lines)))
+ ((eql field :tags)
+ (string-match "tags: *\\(.*\\)" info)
+ (let ((tags (match-string 1 info)))
+ (push (vc-fossil--propertize-header-line "Tags : " tags) lines)))))
(apply #'concat (nreverse lines))))
-;;; STATE-CHANGING FUNCTIONS
+;; - dir-printer (fileinfo)
+
+;; - status-fileinfo-extra (file)
+
+(defun vc-fossil-working-revision (file)
+ (let ((line (vc-fossil--run "finfo" "-s" (file-truename file))))
+ (and line
+ (cadr (split-string line)))))
+
+(defun vc-fossil-checkout-model (files) 'implicit)
+
+;; - mode-line-string (file)
+
+;; STATE-CHANGING FUNCTIONS
(defun vc-fossil-create-repo ()
- "Create a new Fossil Repository."
(vc-fossil--command nil 0 nil "new"))
-;; We ignore the comment. There's no comment on add.
(defun vc-fossil-register (files &optional rev comment)
- "Register FILE into the fossil version-control system."
+ ;; We ignore the comment. There's no comment on add.
(vc-fossil--command nil 0 files "add"))
(defun vc-fossil-responsible-p (file)
(vc-fossil-root file))
+;; - receive-file (file rev)
+
(defun vc-fossil-unregister (file)
(vc-fossil--command nil 0 file "rm"))
-(declare-function log-edit-extract-headers "log-edit" (headers string))
-
-(defun vc-fossil--checkin (files comment &optional rev)
+(defun vc-fossil-checkin (files comment &optional rev)
(apply 'vc-fossil--command nil 0 files
- (nconc (list "commit" "-m")
- (log-edit-extract-headers
- `(("Author" . "--user-override")
- ("Date" . "--date-override"))
- comment)
- (vc-switches 'Fossil 'checkin))))
-
-(if (>= emacs-major-version 25)
- (defun vc-fossil-checkin (files comment &optional rev)
- (vc-fossil--checkin files comment rev))
- (defun vc-fossil-checkin (files rev comment)
- (vc-fossil--checkin files comment rev)))
+ (nconc (list "commit" "-m")
+ (log-edit-extract-headers
+ `(("Author" . "--user-override")
+ ("Date" . "--date-override"))
+ comment)
+ (vc-switches 'Fossil 'checkin))))
(defun vc-fossil-find-revision (file rev buffer)
(apply #'vc-fossil--command buffer 0 file
- "cat"
- (nconc
- (unless (zerop (length rev)) (list "-r" rev))
- (vc-switches 'Fossil 'checkout))))
+ "cat"
+ (nconc
+ (unless (zerop (length rev)) (list "-r" rev))
+ (vc-switches 'Fossil 'checkout))))
(defun vc-fossil-checkout (file &optional editable rev)
(apply #'vc-fossil--command nil 0 file
- "update"
- (nconc
- (cond
- ((eq rev t) (list "current"))
- ((equal rev "") (list "trunk"))
- ((stringp rev) (list rev)))
- (vc-switches 'Fossil 'checkout))))
+ "update"
+ (nconc
+ (cond
+ ((eq rev t) (list "current"))
+ ((equal rev "") (list "trunk"))
+ ((stringp rev) (list rev)))
+ (vc-switches 'Fossil 'checkout))))
(defun vc-fossil-revert (file &optional contents-done)
- "Revert FILE to the version stored in the fossil repository."
- (if contents-done t
+ (if contents-done
+ t
(vc-fossil--command nil 0 file "revert")))
-(defun vc-fossil-pull (prompt)
- "Pull upstream changes into the current branch.
+;; - merge-file (file &optional rev1 rev2)
+
+;; - merge-branch ()
-With a prefix argument, or if PROMPT is non-nil, prompt for a specific
-Fossil pull command. The default is \"fossil update\"."
+;; - merge-news (file)
+
+(defvar vc-fossil--pull-history nil)
+(defvar vc-fossil--push-history nil)
+
+(defun vc-fossil-pull (prompt)
(interactive "P")
- (vc-fossil--do-async-prompted-command "update" prompt 'vc-fossil-pull-history))
+ (vc-fossil--do-async-prompted-command "update" prompt 'vc-fossil--pull-history))
(defun vc-fossil-push (prompt)
- "Push changes to upstream repository.
-
-With a prefix argument or if PROMPT is non-nil, prompt for a specific
-Fossil push command. The default is \"fossil push\"."
(interactive "P")
(vc-fossil--do-async-prompted-command "push" prompt 'vc-fossil-push-history))
-;; HISTORY FUNCTIONS
+;; - steal-lock (file &optional revision)
-;; FIXME, we actually already have short, start and limit, need to
-;; add it into the code
+;; - modify-change-comment (files rev comment)
-(autoload 'vc-setup-buffer "vc-dispatcher")
+;; - mark-resolved (files)
+
+;; - find-admin-dir (file)
+
+;; HISTORY FUNCTIONS
(defun vc-fossil-print-log (files buffer &optional shortlog start-revision limit)
- "Print full log for a file"
+ ;; TODO: We actually already have short, start and limit, need to
+ ;; add it into the code.
(vc-setup-buffer buffer)
(let ((inhibit-read-only t))
(with-current-buffer buffer
(dolist (file files)
- (apply #'vc-fossil--command buffer 0 nil "timeline"
- (nconc
- (when start-revision (list "before" start-revision))
- (when limit (list "-n" (number-to-string limit)))
- (list "-p" (file-relative-name (expand-file-name file)))))))))
+ (apply #'vc-fossil--command buffer 0 nil "timeline"
+ (nconc
+ (when start-revision (list "before" start-revision))
+ (when limit (list "-n" (number-to-string limit)))
+ (list "-p" (file-relative-name (expand-file-name file)))))))))
+
+;; * log-outgoing (buffer remote-location)
+
+;; * log-incoming (buffer remote-location)
+
+;; - log-search (buffer pattern)
(defvar log-view-message-re)
(defvar log-view-file-re)
@@ -416,7 +434,6 @@ Fossil push command. The default is \"f
(defvar log-view-per-file-logs)
(define-derived-mode vc-fossil-log-view-mode log-view-mode "Fossil-Log-View"
- (require 'add-log) ;; we need the add-log faces
(setq word-wrap t)
(set (make-local-variable 'wrap-prefix) " ")
(set (make-local-variable 'log-view-file-re) "\\`a\\`")
@@ -425,53 +442,57 @@ Fossil push command. The default is \"f
"^[0-9:]+ \\[\\([0-9a-fA-F]*\\)\\] \\(?:\\*[^*]*\\*\\)? ?\\(.*\\)")
(set (make-local-variable 'log-view-font-lock-keywords)
(append
- '(
- ("^\\([0-9:]*\\) \\(\\[[[:alnum:]]*\\]\\) \\(\\(?:\\*[[:word:]]*\\*\\)?\\) ?\\(.*?\\) (user: \\([[:word:]]*\\) tags: \\(.*\\))"
- (1 'change-log-date)
- (2 'change-log-name)
- (3 'highlight)
- (4 'log-view-message)
- (5 'change-log-name)
- (6 'highlight))
- ("^=== \\(.*\\) ==="
- (1 'change-log-date))))))
+ '(
+ ("^\\([0-9:]*\\) \\(\\[[[:alnum:]]*\\]\\) \\(\\(?:\\*[[:word:]]*\\*\\)?\\) ?\\(.*?\\) (user: \\([[:word:]]*\\) tags: \\(.*\\))"
+ (1 'change-log-date)
+ (2 'change-log-name)
+ (3 'highlight)
+ (4 'log-view-message)
+ (5 'change-log-name)
+ (6 'highlight))
+ ("^=== \\(.*\\) ==="
+ (1 'change-log-date))))))
+
+;; - show-log-entry (revision)
+
+;; - comment-history (file)
+
+;; - update-changelog (files)
-;; TODO: implement diff for directories
(defun vc-fossil-diff (files &optional rev1 rev2 buffer async)
- "Get Differences for a file"
+ ;; TODO: Implement diff for directories.
(let ((buf (or buffer "*vc-diff*"))
- (root (and files (expand-file-name (vc-fossil-root (car files))))))
- ;; if we diff the root directory, do not specify a file
+ (root (and files (expand-file-name (vc-fossil-root (car files))))))
+ ;; If we diff the root directory, do not specify a file.
(if (or (null files)
- (and (null (cdr files))
- (equal root (expand-file-name (car files)))))
- (setq files nil))
+ (and (null (cdr files))
+ (equal root (expand-file-name (car files)))))
+ (setq files nil))
(apply #'vc-fossil--command
- buf 0 files "diff" "-i"
- (nconc
- (cond
- (rev2 (list "--from" (or rev1 "current") "--to" rev2))
- (rev1 (list "--from" rev1)))
- (vc-switches 'Fossil 'diff)))))
+ buf 0 files "diff" "-i"
+ (nconc
+ (cond
+ (rev2 (list "--from" (or rev1 "current") "--to" rev2))
+ (rev1 (list "--from" rev1)))
+ (vc-switches 'Fossil 'diff)))))
-(declare-function vc-annotate-convert-time "vc-annotate" (time))
-
-(defun vc-fossil-annotate-command (file buffer &optional rev)
- "Execute \"fossil annotate\" on FILE, inserting the contents in BUFFER.
-If REV is specified, annotate that revision."
- ;;(assert (not rev) nil "Annotating a revision not supported")
- (vc-fossil--command buffer 0 file "annotate"))
+;; - revision-completion-table (files)
(defconst vc-fossil-annotate-re
"\\([[:word:]]+\\)\\s-+\\([-0-9]+\\)\\s-+[0-9]+: ")
-;; TODO: currently only the date is used, not the time
+(defun vc-fossil-annotate-command (file buffer &optional rev)
+ (vc-fossil--command buffer 0 file "annotate"))
+
(defun vc-fossil-annotate-time ()
+ ;; TODO: Currently only the date is used, not the time.
(when (looking-at vc-fossil-annotate-re)
(goto-char (match-end 0))
(vc-annotate-convert-time
(date-to-time (format "%s 00:00:00" (match-string-no-properties 2))))))
+;; - annotate-current-time ()
+
(defun vc-fossil-annotate-extract-revision-at-line ()
(save-excursion
(beginning-of-line)
@@ -479,60 +500,73 @@ If REV is specified, annotate that revis
(goto-char (match-end 0))
(match-string-no-properties 1))))
-;;; TAG SYSTEM
+;; - region-history (file buffer lfrom lto)
+
+;; - region-history-mode ()
+
+;; - mergebase (rev1 &optional rev2)
-;; FIXME: we need a convenience function to check that there's nothing checked
-;; out in the tree, since we tag or branch the whole repository
+;; TAG SYSTEM
(defun vc-fossil-create-tag (file name branchp)
(let* ((dir (if (file-directory-p file) file (file-name-directory file)))
- (default-directory dir))
+ (default-directory dir))
(apply #'vc-fossil--command nil 0 nil `(,@(if branchp
- '("branch" "new")
- '("tag" "add"))
- ,name ,(vc-fossil--get-id dir)))))
-
-;; FIXME: we should update buffers if update is non-nill
+ '("branch" "new")
+ '("tag" "add"))
+ ,name ,(vc-fossil--get-id dir)))))
(defun vc-fossil-retrieve-tag (dir name update)
(let ((default-directory dir))
(vc-fossil--command nil 0 nil "checkout" name)))
-;;; MISCELLANEOUS
+;; MISCELLANEOUS
+
+;; - make-version-backups-p (file)
+
+(defun vc-fossil-root (file)
+ (or (vc-find-root file ".fslckout")
+ (vc-find-root file "_FOSSIL_")))
+
+;; - ignore (file &optional directory)
+
+;; - ignore-completion-table
(defun vc-fossil-previous-revision (file rev)
- "Fossil specific version of the `vc-previous-revision'."
(with-temp-buffer
(cond
(file
(vc-fossil--command t 0 (file-truename file) "finfo" "-l" "-b")
(goto-char (point-min))
(and (re-search-forward (concat "^" (regexp-quote rev)) nil t)
- (zerop (forward-line))
- (looking-at "^\\([0-9a-zA-Z]+\\)")
- (match-string 1)))
+ (zerop (forward-line))
+ (looking-at "^\\([0-9a-zA-Z]+\\)")
+ (match-string 1)))
(t
(vc-fossil--command t 0 nil "info" rev)
(goto-char (point-min))
(and (re-search-forward "parent: *\\([0-9a-fA-F]+\\)" nil t)
- (match-string 1))))))
+ (match-string 1))))))
(defun vc-fossil-next-revision (file rev)
- "Fossil specific version of the `vc-previous-revision'."
(with-temp-buffer
(cond
(file
(vc-fossil--command t 0 (file-truename file) "finfo" "-l" "-b")
(goto-char (point-min))
(and (re-search-forward (concat "^" (regexp-quote rev)) nil t)
- (zerop (forward-line -1))
- (looking-at "^\\([0-9a-zA-Z]+\\)")
- (match-string 1)))
+ (zerop (forward-line -1))
+ (looking-at "^\\([0-9a-zA-Z]+\\)")
+ (match-string 1)))
(t
(vc-fossil--command t 0 nil "info" rev)
(goto-char (point-min))
(and (re-search-forward "child: *\\([0-9a-fA-F]+\\)" nil t)
- (match-string 1))))))
+ (match-string 1))))))
+
+;; - log-edit-mode ()
+
+;; - check-headers ()
(defun vc-fossil-delete-file (file)
(vc-fossil--command nil 0 (file-truename file) "rm" "--hard"))
@@ -540,6 +574,14 @@ If REV is specified, annotate that revis
(defun vc-fossil-rename-file (old new)
(vc-fossil--command nil 0 (list (file-truename old) (file-truename new)) "mv" "--hard"))
+;; - find-file-hook ()
+
+;; - extra-menu ()
+
+;; - extra-dir-menu ()
+
+;; - conflicted-files (dir)
+
;;; This snippet enables the Fossil VC backend so it will work once
;;; this file is loaded. By also marking it for inclusion in the
;;; autoloads file, installing packaged versions of this should work
|