aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-03-26 07:15:05 +0000
committerDan Nicolaescu2008-03-26 07:15:05 +0000
commit920fb2b0fde98594608cb434be509340bd8b137f (patch)
tree6449e923b3d7a9e1dcf276fd3e12ce6ea888874d
parent117d3cc5bba07992caca2937c87f687c8d5c724f (diff)
downloademacs-920fb2b0fde98594608cb434be509340bd8b137f.tar.gz
emacs-920fb2b0fde98594608cb434be509340bd8b137f.zip
(vc-cvs-parse-status, vc-cvs-after-dir-status): Detect
missing files.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/vc-cvs.el64
2 files changed, 37 insertions, 30 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 44b84a4e1d9..bb8f3cdd4ef 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12008-03-26 Dan Nicolaescu <dann@ics.uci.edu> 12008-03-26 Dan Nicolaescu <dann@ics.uci.edu>
2 2
3 * vc-cvs.el (vc-cvs-parse-status, vc-cvs-after-dir-status): Detect
4 missing files.
5
3 * vc-git.el (vc-git-extra-menu-map): New key map. 6 * vc-git.el (vc-git-extra-menu-map): New key map.
4 (vc-git-extra-menu, vc-git-extra-status-menu, vc-git-grep): 7 (vc-git-extra-menu, vc-git-extra-status-menu, vc-git-grep):
5 New functions. 8 New functions.
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index a338b5115b8..0d1a2be9164 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -823,40 +823,42 @@ For an empty string, nil is returned (invalid CVS root)."
823Set file properties accordingly. Unless FULL is t, parse only 823Set file properties accordingly. Unless FULL is t, parse only
824essential information. Note that this can never set the 'ignored 824essential information. Note that this can never set the 'ignored
825state." 825state."
826 (let (file status) 826 (let (file status missing)
827 (goto-char (point-min)) 827 (goto-char (point-min))
828 (while (looking-at "? \\(.*\\)") 828 (while (looking-at "? \\(.*\\)")
829 (setq file (expand-file-name (match-string 1))) 829 (setq file (expand-file-name (match-string 1)))
830 (vc-file-setprop file 'vc-state 'unregistered) 830 (vc-file-setprop file 'vc-state 'unregistered)
831 (forward-line 1)) 831 (forward-line 1))
832 (if (re-search-forward "^File: " nil t) 832 (when (re-search-forward "^File: " nil t)
833 (cond 833 (when (setq missing (looking-at "no file "))
834 ((looking-at "no file") nil) 834 (goto-char (match-end 0)))
835 ((re-search-forward "\\=\\([^ \t]+\\)" nil t) 835 (cond
836 (setq file (expand-file-name (match-string 1))) 836 ((re-search-forward "\\=\\([^ \t]+\\)" nil t)
837 (vc-file-setprop file 'vc-backend 'CVS) 837 (setq file (expand-file-name (match-string 1)))
838 (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t)) 838 (vc-file-setprop file 'vc-backend 'CVS)
839 (setq status "Unknown") 839 (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t))
840 (setq status (match-string 1))) 840 (setq status "Unknown")
841 (if (and full 841 (setq status (match-string 1)))
842 (re-search-forward 842 (if (and full
843 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\ 843 (re-search-forward
844 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\
844\[\t ]+\\([0-9.]+\\)" 845\[\t ]+\\([0-9.]+\\)"
845 nil t)) 846 nil t))
846 (vc-file-setprop file 'vc-latest-revision (match-string 2))) 847 (vc-file-setprop file 'vc-latest-revision (match-string 2)))
847 (vc-file-setprop 848 (vc-file-setprop
848 file 'vc-state 849 file 'vc-state
849 (cond 850 (cond
850 ((string-match "Up-to-date" status) 851 ((string-match "Up-to-date" status)
851 (vc-file-setprop file 'vc-checkout-time 852 (vc-file-setprop file 'vc-checkout-time
852 (nth 5 (file-attributes file))) 853 (nth 5 (file-attributes file)))
853 'up-to-date) 854 'up-to-date)
854 ((string-match "Locally Modified" status) 'edited) 855 ((string-match "Locally Modified" status) 'edited)
855 ((string-match "Needs Merge" status) 'needs-merge) 856 ((string-match "Needs Merge" status) 'needs-merge)
856 ((string-match "Needs \\(Checkout\\|Patch\\)" status) 'needs-patch) 857 ((string-match "Needs \\(Checkout\\|Patch\\)" status)
857 ((string-match "Locally Added" status) 'added) 858 (if missing 'missing 'needs-patch))
858 ((string-match "Locally Removed" status) 'removed) 859 ((string-match "Locally Added" status) 'added)
859 (t 'edited)))))))) 860 ((string-match "Locally Removed" status) 'removed)
861 (t 'edited))))))))
860 862
861(defun vc-cvs-dir-state-heuristic (dir) 863(defun vc-cvs-dir-state-heuristic (dir)
862 "Find the CVS state of all files in DIR, using only local information." 864 "Find the CVS state of all files in DIR, using only local information."
@@ -879,6 +881,7 @@ state."
879 (status-str nil) 881 (status-str nil)
880 (file nil) 882 (file nil)
881 (result nil) 883 (result nil)
884 (missing nil)
882 (subdir default-directory)) 885 (subdir default-directory))
883 (goto-char (point-min)) 886 (goto-char (point-min))
884 (while 887 (while
@@ -901,8 +904,9 @@ state."
901 (forward-line 1)) 904 (forward-line 1))
902 ;; A file entry. 905 ;; A file entry.
903 (when (re-search-forward "^File: " nil t) 906 (when (re-search-forward "^File: " nil t)
907 (when (setq missing (looking-at "no file "))
908 (goto-char (match-end 0)))
904 (cond 909 (cond
905 ((looking-at "no file") nil)
906 ((re-search-forward "\\=\\([^ \t]+\\)" nil t) 910 ((re-search-forward "\\=\\([^ \t]+\\)" nil t)
907 (setq file (file-relative-name 911 (setq file (file-relative-name
908 (expand-file-name (match-string 1) subdir))) 912 (expand-file-name (match-string 1) subdir)))
@@ -915,7 +919,7 @@ state."
915 ((string-match "Locally Modified" status-str) 'edited) 919 ((string-match "Locally Modified" status-str) 'edited)
916 ((string-match "Needs Merge" status-str) 'needs-merge) 920 ((string-match "Needs Merge" status-str) 'needs-merge)
917 ((string-match "Needs \\(Checkout\\|Patch\\)" status-str) 921 ((string-match "Needs \\(Checkout\\|Patch\\)" status-str)
918 'needs-patch) 922 (if missing 'missing 'needs-patch))
919 ((string-match "Locally Added" status-str) 'added) 923 ((string-match "Locally Added" status-str) 'added)
920 ((string-match "Locally Removed" status-str) 'removed) 924 ((string-match "Locally Removed" status-str) 'removed)
921 (t 'edited))) 925 (t 'edited)))