diff options
| author | Stefan Monnier | 2010-03-05 23:05:47 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-03-05 23:05:47 -0500 |
| commit | 4c83ed3d48c69e12c91a2ada2d00f4f74be2a42d (patch) | |
| tree | 8d2779821df83cbf828c220e9d92be2e8064907e | |
| parent | d40a757070ebeb430b83f8a11b7b0c9279b7fb0b (diff) | |
| download | emacs-4c83ed3d48c69e12c91a2ada2d00f4f74be2a42d.tar.gz emacs-4c83ed3d48c69e12c91a2ada2d00f4f74be2a42d.zip | |
* vc-git.el: Re-flow to fit into 80 columns.
(vc-git-after-dir-status-stage, vc-git-dir-status-goto-stage):
Remove spurious `quote' element in each case alternative.
(vc-git-show-log-entry): Use prog1.
(vc-git-after-dir-status-stage): Remove unused var `remaining'.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/vc-git.el | 174 |
2 files changed, 113 insertions, 69 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8ec6003744d..512e83999ab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-03-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc-git.el: Re-flow to fit into 80 columns. | ||
| 4 | (vc-git-after-dir-status-stage, vc-git-dir-status-goto-stage): | ||
| 5 | Remove spurious `quote' element in each case alternative. | ||
| 6 | (vc-git-show-log-entry): Use prog1. | ||
| 7 | (vc-git-after-dir-status-stage): Remove unused var `remaining'. | ||
| 8 | |||
| 1 | 2010-03-06 Glenn Morris <rgm@gnu.org> | 9 | 2010-03-06 Glenn Morris <rgm@gnu.org> |
| 2 | 10 | ||
| 3 | * cedet/semantic/grammar.el (semantic-grammar-header-template): | 11 | * cedet/semantic/grammar.el (semantic-grammar-header-template): |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 0d8e6307d6e..d645a4c05ba 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -69,8 +69,8 @@ | |||
| 69 | ;; * revert (file &optional contents-done) OK | 69 | ;; * revert (file &optional contents-done) OK |
| 70 | ;; - rollback (files) COULD BE SUPPORTED | 70 | ;; - rollback (files) COULD BE SUPPORTED |
| 71 | ;; - merge (file rev1 rev2) It would be possible to merge | 71 | ;; - merge (file rev1 rev2) It would be possible to merge |
| 72 | ;; changes into a single file, but when | 72 | ;; changes into a single file, but |
| 73 | ;; committing they wouldn't | 73 | ;; when committing they wouldn't |
| 74 | ;; be identified as a merge | 74 | ;; be identified as a merge |
| 75 | ;; by git, so it's probably | 75 | ;; by git, so it's probably |
| 76 | ;; not a good idea. | 76 | ;; not a good idea. |
| @@ -130,7 +130,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 130 | 130 | ||
| 131 | ;;;###autoload (defun vc-git-registered (file) | 131 | ;;;###autoload (defun vc-git-registered (file) |
| 132 | ;;;###autoload "Return non-nil if FILE is registered with git." | 132 | ;;;###autoload "Return non-nil if FILE is registered with git." |
| 133 | ;;;###autoload (if (vc-find-root file ".git") ; short cut | 133 | ;;;###autoload (if (vc-find-root file ".git") ; Short cut. |
| 134 | ;;;###autoload (progn | 134 | ;;;###autoload (progn |
| 135 | ;;;###autoload (load "vc-git") | 135 | ;;;###autoload (load "vc-git") |
| 136 | ;;;###autoload (vc-git-registered file)))) | 136 | ;;;###autoload (vc-git-registered file)))) |
| @@ -149,9 +149,11 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 149 | (str (ignore-errors | 149 | (str (ignore-errors |
| 150 | (cd dir) | 150 | (cd dir) |
| 151 | (vc-git--out-ok "ls-files" "-c" "-z" "--" name) | 151 | (vc-git--out-ok "ls-files" "-c" "-z" "--" name) |
| 152 | ;; if result is empty, use ls-tree to check for deleted file | 152 | ;; If result is empty, use ls-tree to check for deleted |
| 153 | ;; file. | ||
| 153 | (when (eq (point-min) (point-max)) | 154 | (when (eq (point-min) (point-max)) |
| 154 | (vc-git--out-ok "ls-tree" "--name-only" "-z" "HEAD" "--" name)) | 155 | (vc-git--out-ok "ls-tree" "--name-only" "-z" "HEAD" |
| 156 | "--" name)) | ||
| 155 | (buffer-string)))) | 157 | (buffer-string)))) |
| 156 | (and str | 158 | (and str |
| 157 | (> (length str) (length name)) | 159 | (> (length str) (length name)) |
| @@ -173,7 +175,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 173 | (if (not (vc-git-registered file)) | 175 | (if (not (vc-git-registered file)) |
| 174 | 'unregistered | 176 | 'unregistered |
| 175 | (vc-git--call nil "add" "--refresh" "--" (file-relative-name file)) | 177 | (vc-git--call nil "add" "--refresh" "--" (file-relative-name file)) |
| 176 | (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--"))) | 178 | (let ((diff (vc-git--run-command-string |
| 179 | file "diff-index" "-z" "HEAD" "--"))) | ||
| 177 | (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0" | 180 | (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0" |
| 178 | diff)) | 181 | diff)) |
| 179 | (vc-git--state-code (match-string 1 diff)) | 182 | (vc-git--state-code (match-string 1 diff)) |
| @@ -206,11 +209,12 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 206 | 209 | ||
| 207 | (defstruct (vc-git-extra-fileinfo | 210 | (defstruct (vc-git-extra-fileinfo |
| 208 | (:copier nil) | 211 | (:copier nil) |
| 209 | (:constructor vc-git-create-extra-fileinfo (old-perm new-perm &optional rename-state orig-name)) | 212 | (:constructor vc-git-create-extra-fileinfo |
| 213 | (old-perm new-perm &optional rename-state orig-name)) | ||
| 210 | (:conc-name vc-git-extra-fileinfo->)) | 214 | (:conc-name vc-git-extra-fileinfo->)) |
| 211 | old-perm new-perm ;; permission flags | 215 | old-perm new-perm ;; Permission flags. |
| 212 | rename-state ;; rename or copy state | 216 | rename-state ;; Rename or copy state. |
| 213 | orig-name) ;; original name for renames or copies | 217 | orig-name) ;; Original name for renames or copies. |
| 214 | 218 | ||
| 215 | (defun vc-git-escape-file-name (name) | 219 | (defun vc-git-escape-file-name (name) |
| 216 | "Escape a file name if necessary." | 220 | "Escape a file name if necessary." |
| @@ -232,23 +236,23 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 232 | (let* ((old-type (lsh (or old-perm 0) -9)) | 236 | (let* ((old-type (lsh (or old-perm 0) -9)) |
| 233 | (new-type (lsh (or new-perm 0) -9)) | 237 | (new-type (lsh (or new-perm 0) -9)) |
| 234 | (str (case new-type | 238 | (str (case new-type |
| 235 | (?\100 ;; file | 239 | (?\100 ;; File. |
| 236 | (case old-type | 240 | (case old-type |
| 237 | (?\100 nil) | 241 | (?\100 nil) |
| 238 | (?\120 " (type change symlink -> file)") | 242 | (?\120 " (type change symlink -> file)") |
| 239 | (?\160 " (type change subproject -> file)"))) | 243 | (?\160 " (type change subproject -> file)"))) |
| 240 | (?\120 ;; symlink | 244 | (?\120 ;; Symlink. |
| 241 | (case old-type | 245 | (case old-type |
| 242 | (?\100 " (type change file -> symlink)") | 246 | (?\100 " (type change file -> symlink)") |
| 243 | (?\160 " (type change subproject -> symlink)") | 247 | (?\160 " (type change subproject -> symlink)") |
| 244 | (t " (symlink)"))) | 248 | (t " (symlink)"))) |
| 245 | (?\160 ;; subproject | 249 | (?\160 ;; Subproject. |
| 246 | (case old-type | 250 | (case old-type |
| 247 | (?\100 " (type change file -> subproject)") | 251 | (?\100 " (type change file -> subproject)") |
| 248 | (?\120 " (type change symlink -> subproject)") | 252 | (?\120 " (type change symlink -> subproject)") |
| 249 | (t " (subproject)"))) | 253 | (t " (subproject)"))) |
| 250 | (?\110 nil) ;; directory (internal, not a real git state) | 254 | (?\110 nil) ;; Directory (internal, not a real git state). |
| 251 | (?\000 ;; deleted or unknown | 255 | (?\000 ;; Deleted or unknown. |
| 252 | (case old-type | 256 | (case old-type |
| 253 | (?\120 " (symlink)") | 257 | (?\120 " (symlink)") |
| 254 | (?\160 " (subproject)"))) | 258 | (?\160 " (subproject)"))) |
| @@ -258,7 +262,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 258 | (t "")))) | 262 | (t "")))) |
| 259 | 263 | ||
| 260 | (defun vc-git-rename-as-string (state extra) | 264 | (defun vc-git-rename-as-string (state extra) |
| 261 | "Return a string describing the copy or rename associated with INFO, or an empty string if none." | 265 | "Return a string describing the copy or rename associated with INFO, |
| 266 | or an empty string if none." | ||
| 262 | (let ((rename-state (when extra | 267 | (let ((rename-state (when extra |
| 263 | (vc-git-extra-fileinfo->rename-state extra)))) | 268 | (vc-git-extra-fileinfo->rename-state extra)))) |
| 264 | (if rename-state | 269 | (if rename-state |
| @@ -267,8 +272,10 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 267 | (if (eq rename-state 'copy) "copied from " | 272 | (if (eq rename-state 'copy) "copied from " |
| 268 | (if (eq state 'added) "renamed from " | 273 | (if (eq state 'added) "renamed from " |
| 269 | "renamed to ")) | 274 | "renamed to ")) |
| 270 | (vc-git-escape-file-name (vc-git-extra-fileinfo->orig-name extra)) | 275 | (vc-git-escape-file-name |
| 271 | ")") 'face 'font-lock-comment-face) | 276 | (vc-git-extra-fileinfo->orig-name extra)) |
| 277 | ")") | ||
| 278 | 'face 'font-lock-comment-face) | ||
| 272 | ""))) | 279 | ""))) |
| 273 | 280 | ||
| 274 | (defun vc-git-permissions-as-string (old-perm new-perm) | 281 | (defun vc-git-permissions-as-string (old-perm new-perm) |
| @@ -302,7 +309,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 302 | " " (vc-git-permissions-as-string old-perm new-perm) | 309 | " " (vc-git-permissions-as-string old-perm new-perm) |
| 303 | " " | 310 | " " |
| 304 | (propertize (vc-git-escape-file-name (vc-dir-fileinfo->name info)) | 311 | (propertize (vc-git-escape-file-name (vc-dir-fileinfo->name info)) |
| 305 | 'face (if isdir 'font-lock-comment-delimiter-face 'font-lock-function-name-face) | 312 | 'face (if isdir 'font-lock-comment-delimiter-face |
| 313 | 'font-lock-function-name-face) | ||
| 306 | 'help-echo | 314 | 'help-echo |
| 307 | (if isdir | 315 | (if isdir |
| 308 | "Directory\nVC operations can be applied to it\nmouse-3: Pop-up menu" | 316 | "Directory\nVC operations can be applied to it\nmouse-3: Pop-up menu" |
| @@ -314,32 +322,39 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 314 | 322 | ||
| 315 | (defun vc-git-after-dir-status-stage (stage files update-function) | 323 | (defun vc-git-after-dir-status-stage (stage files update-function) |
| 316 | "Process sentinel for the various dir-status stages." | 324 | "Process sentinel for the various dir-status stages." |
| 317 | (let (remaining next-stage result) | 325 | (let (next-stage result) |
| 318 | (goto-char (point-min)) | 326 | (goto-char (point-min)) |
| 319 | (case stage | 327 | (case stage |
| 320 | ('update-index | 328 | (update-index |
| 321 | (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added | 329 | (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added |
| 322 | (if files 'ls-files-up-to-date 'diff-index)))) | 330 | (if files 'ls-files-up-to-date 'diff-index)))) |
| 323 | ('ls-files-added | 331 | (ls-files-added |
| 324 | (setq next-stage 'ls-files-unknown) | 332 | (setq next-stage 'ls-files-unknown) |
| 325 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) | 333 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) |
| 326 | (let ((new-perm (string-to-number (match-string 1) 8)) | 334 | (let ((new-perm (string-to-number (match-string 1) 8)) |
| 327 | (name (match-string 2))) | 335 | (name (match-string 2))) |
| 328 | (push (list name 'added (vc-git-create-extra-fileinfo 0 new-perm)) result)))) | 336 | (push (list name 'added (vc-git-create-extra-fileinfo 0 new-perm)) |
| 329 | ('ls-files-up-to-date | 337 | result)))) |
| 338 | (ls-files-up-to-date | ||
| 330 | (setq next-stage 'diff-index) | 339 | (setq next-stage 'diff-index) |
| 331 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) | 340 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) |
| 332 | (let ((perm (string-to-number (match-string 1) 8)) | 341 | (let ((perm (string-to-number (match-string 1) 8)) |
| 333 | (name (match-string 2))) | 342 | (name (match-string 2))) |
| 334 | (push (list name 'up-to-date (vc-git-create-extra-fileinfo perm perm)) result)))) | 343 | (push (list name 'up-to-date |
| 335 | ('ls-files-unknown | 344 | (vc-git-create-extra-fileinfo perm perm)) |
| 345 | result)))) | ||
| 346 | (ls-files-unknown | ||
| 336 | (when files (setq next-stage 'ls-files-ignored)) | 347 | (when files (setq next-stage 'ls-files-ignored)) |
| 337 | (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1) | 348 | (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1) |
| 338 | (push (list (match-string 1) 'unregistered (vc-git-create-extra-fileinfo 0 0)) result))) | 349 | (push (list (match-string 1) 'unregistered |
| 339 | ('ls-files-ignored | 350 | (vc-git-create-extra-fileinfo 0 0)) |
| 351 | result))) | ||
| 352 | (ls-files-ignored | ||
| 340 | (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1) | 353 | (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1) |
| 341 | (push (list (match-string 1) 'ignored (vc-git-create-extra-fileinfo 0 0)) result))) | 354 | (push (list (match-string 1) 'ignored |
| 342 | ('diff-index | 355 | (vc-git-create-extra-fileinfo 0 0)) |
| 356 | result))) | ||
| 357 | (diff-index | ||
| 343 | (setq next-stage 'ls-files-unknown) | 358 | (setq next-stage 'ls-files-unknown) |
| 344 | (while (re-search-forward | 359 | (while (re-search-forward |
| 345 | ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0" | 360 | ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0" |
| @@ -349,41 +364,60 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 349 | (state (or (match-string 4) (match-string 6))) | 364 | (state (or (match-string 4) (match-string 6))) |
| 350 | (name (or (match-string 5) (match-string 7))) | 365 | (name (or (match-string 5) (match-string 7))) |
| 351 | (new-name (match-string 8))) | 366 | (new-name (match-string 8))) |
| 352 | (if new-name ; copy or rename | 367 | (if new-name ; Copy or rename. |
| 353 | (if (eq ?C (string-to-char state)) | 368 | (if (eq ?C (string-to-char state)) |
| 354 | (push (list new-name 'added (vc-git-create-extra-fileinfo old-perm new-perm 'copy name)) result) | 369 | (push (list new-name 'added |
| 355 | (push (list name 'removed (vc-git-create-extra-fileinfo 0 0 'rename new-name)) result) | 370 | (vc-git-create-extra-fileinfo old-perm new-perm |
| 356 | (push (list new-name 'added (vc-git-create-extra-fileinfo old-perm new-perm 'rename name)) result)) | 371 | 'copy name)) |
| 357 | (push (list name (vc-git--state-code state) (vc-git-create-extra-fileinfo old-perm new-perm)) result)))))) | 372 | result) |
| 373 | (push (list name 'removed | ||
| 374 | (vc-git-create-extra-fileinfo 0 0 | ||
| 375 | 'rename new-name)) | ||
| 376 | result) | ||
| 377 | (push (list new-name 'added | ||
| 378 | (vc-git-create-extra-fileinfo old-perm new-perm | ||
| 379 | 'rename name)) | ||
| 380 | result)) | ||
| 381 | (push (list name (vc-git--state-code state) | ||
| 382 | (vc-git-create-extra-fileinfo old-perm new-perm)) | ||
| 383 | result)))))) | ||
| 358 | (when result | 384 | (when result |
| 359 | (setq result (nreverse result)) | 385 | (setq result (nreverse result)) |
| 360 | (when files | 386 | (when files |
| 361 | (dolist (entry result) (setq files (delete (car entry) files))) | 387 | (dolist (entry result) (setq files (delete (car entry) files))) |
| 362 | (unless files (setq next-stage nil)))) | 388 | (unless files (setq next-stage nil)))) |
| 363 | (when (or result (not next-stage)) (funcall update-function result next-stage)) | 389 | (when (or result (not next-stage)) |
| 364 | (when next-stage (vc-git-dir-status-goto-stage next-stage files update-function)))) | 390 | (funcall update-function result next-stage)) |
| 391 | (when next-stage | ||
| 392 | (vc-git-dir-status-goto-stage next-stage files update-function)))) | ||
| 365 | 393 | ||
| 366 | (defun vc-git-dir-status-goto-stage (stage files update-function) | 394 | (defun vc-git-dir-status-goto-stage (stage files update-function) |
| 367 | (erase-buffer) | 395 | (erase-buffer) |
| 368 | (case stage | 396 | (case stage |
| 369 | ('update-index | 397 | (update-index |
| 370 | (if files | 398 | (if files |
| 371 | (vc-git-command (current-buffer) 'async files "add" "--refresh" "--") | 399 | (vc-git-command (current-buffer) 'async files "add" "--refresh" "--") |
| 372 | (vc-git-command (current-buffer) 'async nil "update-index" "--refresh"))) | 400 | (vc-git-command (current-buffer) 'async nil |
| 373 | ('ls-files-added | 401 | "update-index" "--refresh"))) |
| 374 | (vc-git-command (current-buffer) 'async files "ls-files" "-z" "-c" "-s" "--")) | 402 | (ls-files-added |
| 375 | ('ls-files-up-to-date | 403 | (vc-git-command (current-buffer) 'async files |
| 376 | (vc-git-command (current-buffer) 'async files "ls-files" "-z" "-c" "-s" "--")) | 404 | "ls-files" "-z" "-c" "-s" "--")) |
| 377 | ('ls-files-unknown | 405 | (ls-files-up-to-date |
| 378 | (vc-git-command (current-buffer) 'async files "ls-files" "-z" "-o" | 406 | (vc-git-command (current-buffer) 'async files |
| 379 | "--directory" "--no-empty-directory" "--exclude-standard" "--")) | 407 | "ls-files" "-z" "-c" "-s" "--")) |
| 380 | ('ls-files-ignored | 408 | (ls-files-unknown |
| 381 | (vc-git-command (current-buffer) 'async files "ls-files" "-z" "-o" "-i" | 409 | (vc-git-command (current-buffer) 'async files |
| 382 | "--directory" "--no-empty-directory" "--exclude-standard" "--")) | 410 | "ls-files" "-z" "-o" "--directory" |
| 383 | ('diff-index | 411 | "--no-empty-directory" "--exclude-standard" "--")) |
| 384 | (vc-git-command (current-buffer) 'async files "diff-index" "--relative" "-z" "-M" "HEAD" "--"))) | 412 | (ls-files-ignored |
| 413 | (vc-git-command (current-buffer) 'async files | ||
| 414 | "ls-files" "-z" "-o" "-i" "--directory" | ||
| 415 | "--no-empty-directory" "--exclude-standard" "--")) | ||
| 416 | (diff-index | ||
| 417 | (vc-git-command (current-buffer) 'async files | ||
| 418 | "diff-index" "--relative" "-z" "-M" "HEAD" "--"))) | ||
| 385 | (vc-exec-after | 419 | (vc-exec-after |
| 386 | `(vc-git-after-dir-status-stage (quote ,stage) (quote ,files) (quote ,update-function)))) | 420 | `(vc-git-after-dir-status-stage ',stage ',files ',update-function))) |
| 387 | 421 | ||
| 388 | (defun vc-git-dir-status (dir update-function) | 422 | (defun vc-git-dir-status (dir update-function) |
| 389 | "Return a list of (FILE STATE EXTRA) entries for DIR." | 423 | "Return a list of (FILE STATE EXTRA) entries for DIR." |
| @@ -439,14 +473,16 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 439 | (setq remote | 473 | (setq remote |
| 440 | (with-output-to-string | 474 | (with-output-to-string |
| 441 | (with-current-buffer standard-output | 475 | (with-current-buffer standard-output |
| 442 | (vc-git--out-ok "config" (concat "branch." branch ".remote"))))) | 476 | (vc-git--out-ok "config" |
| 477 | (concat "branch." branch ".remote"))))) | ||
| 443 | (when (string-match "\\([^\n]+\\)" remote) | 478 | (when (string-match "\\([^\n]+\\)" remote) |
| 444 | (setq remote (match-string 1 remote))) | 479 | (setq remote (match-string 1 remote))) |
| 445 | (when remote | 480 | (when remote |
| 446 | (setq remote-url | 481 | (setq remote-url |
| 447 | (with-output-to-string | 482 | (with-output-to-string |
| 448 | (with-current-buffer standard-output | 483 | (with-current-buffer standard-output |
| 449 | (vc-git--out-ok "config" (concat "remote." remote ".url")))))) | 484 | (vc-git--out-ok "config" |
| 485 | (concat "remote." remote ".url")))))) | ||
| 450 | (when (string-match "\\([^\n]+\\)" remote-url) | 486 | (when (string-match "\\([^\n]+\\)" remote-url) |
| 451 | (setq remote-url (match-string 1 remote-url)))) | 487 | (setq remote-url (match-string 1 remote-url)))) |
| 452 | (setq branch "not (detached HEAD)")) | 488 | (setq branch "not (detached HEAD)")) |
| @@ -550,8 +586,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 550 | (append | 586 | (append |
| 551 | '("log" "--no-color") | 587 | '("log" "--no-color") |
| 552 | (when shortlog | 588 | (when shortlog |
| 553 | '("--graph" "--decorate" | 589 | '("--graph" "--decorate" "--date=short" |
| 554 | "--date=short" "--pretty=format:%d%h %ad %s" "--abbrev-commit")) | 590 | "--pretty=format:%d%h %ad %s" "--abbrev-commit")) |
| 555 | (when limit (list "-n" (format "%s" limit))) | 591 | (when limit (list "-n" (format "%s" limit))) |
| 556 | (when start-revision (list start-revision)) | 592 | (when start-revision (list start-revision)) |
| 557 | '("--"))))))) | 593 | '("--"))))))) |
| @@ -565,7 +601,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 565 | (defvar vc-short-log) | 601 | (defvar vc-short-log) |
| 566 | 602 | ||
| 567 | (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View" | 603 | (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View" |
| 568 | (require 'add-log) ;; we need the faces add-log | 604 | (require 'add-log) ;; We need the faces add-log. |
| 569 | ;; Don't have file markers, so use impossible regexp. | 605 | ;; Don't have file markers, so use impossible regexp. |
| 570 | (set (make-local-variable 'log-view-file-re) "\\`a\\`") | 606 | (set (make-local-variable 'log-view-file-re) "\\`a\\`") |
| 571 | (set (make-local-variable 'log-view-per-file-logs) nil) | 607 | (set (make-local-variable 'log-view-per-file-logs) nil) |
| @@ -610,17 +646,16 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 610 | REVISION may have the form BRANCH, BRANCH~N, | 646 | REVISION may have the form BRANCH, BRANCH~N, |
| 611 | or BRANCH^ (where \"^\" can be repeated)." | 647 | or BRANCH^ (where \"^\" can be repeated)." |
| 612 | (goto-char (point-min)) | 648 | (goto-char (point-min)) |
| 613 | (let (found) | 649 | (prog1 |
| 614 | (when revision | 650 | (when revision |
| 615 | (setq found | 651 | (search-forward |
| 616 | (search-forward (format "\ncommit %s" revision) nil t | 652 | (format "\ncommit %s" revision) nil t |
| 617 | (cond ((string-match "~\\([0-9]\\)$" revision) | 653 | (cond ((string-match "~\\([0-9]\\)\\'" revision) |
| 618 | (1+ (string-to-number (match-string 1 revision)))) | 654 | (1+ (string-to-number (match-string 1 revision)))) |
| 619 | ((string-match "\\^+$" revision) | 655 | ((string-match "\\^+\\'" revision) |
| 620 | (1+ (length (match-string 0 revision)))) | 656 | (1+ (length (match-string 0 revision)))) |
| 621 | (t nil))))) | 657 | (t nil)))) |
| 622 | (beginning-of-line) | 658 | (beginning-of-line))) |
| 623 | found)) | ||
| 624 | 659 | ||
| 625 | (defun vc-git-diff (files &optional rev1 rev2 buffer) | 660 | (defun vc-git-diff (files &optional rev1 rev2 buffer) |
| 626 | "Get a difference report using Git between two revisions of FILES." | 661 | "Get a difference report using Git between two revisions of FILES." |
| @@ -948,7 +983,8 @@ Returns nil if not possible." | |||
| 948 | (goto-char (point-min)) | 983 | (goto-char (point-min)) |
| 949 | (= (forward-line 2) 1) | 984 | (= (forward-line 2) 1) |
| 950 | (bolp) | 985 | (bolp) |
| 951 | (buffer-substring-no-properties (point-min) (1- (point-max))))))) | 986 | (buffer-substring-no-properties (point-min) |
| 987 | (1- (point-max))))))) | ||
| 952 | (and name (not (string= name "undefined")) name)))) | 988 | (and name (not (string= name "undefined")) name)))) |
| 953 | 989 | ||
| 954 | (provide 'vc-git) | 990 | (provide 'vc-git) |