* vc-p4.el (vc-p4-diff): Handle deleted files.
[git-p4: depot-paths = "//guest/Ben_Key/vc-p4/,//guest/jonathan_kamens/vc-p4/,//guest/magnus_henoch/vc-p4/": change = 7739]
This commit is contained in:
parent
a8fbf9a3b1
commit
1674c9ea2a
1 changed files with 34 additions and 8 deletions
42
vc-p4.el
42
vc-p4.el
|
@ -512,17 +512,21 @@ files under the default directory otherwise."
|
||||||
(inhibit-read-only t))
|
(inhibit-read-only t))
|
||||||
(cond
|
(cond
|
||||||
((and (null rev1) (null rev2))
|
((and (null rev1) (null rev2))
|
||||||
(let (added modified)
|
(let (added modified deleted)
|
||||||
(dolist (file files)
|
(dolist (file files)
|
||||||
(if (string= (vc-file-getprop file 'vc-p4-action) "add")
|
(cond
|
||||||
(push file added)
|
((string= (vc-file-getprop file 'vc-p4-action) "add")
|
||||||
(push file modified)))
|
(push file added))
|
||||||
|
((string= (vc-file-getprop file 'vc-p4-action) "delete")
|
||||||
|
(push file deleted))
|
||||||
|
(t
|
||||||
|
(push file modified))))
|
||||||
(setq added (nreverse added)
|
(setq added (nreverse added)
|
||||||
modified (nreverse modified))
|
modified (nreverse modified)
|
||||||
|
deleted (nreverse deleted))
|
||||||
|
|
||||||
;; For added files, Perforce can't give us what we want
|
;; For added and deleted files, Perforce can't give us what we
|
||||||
;; (diff the new file against /dev/null), so we do it
|
;; want (diff against /dev/null), so we do it ourselves.
|
||||||
;; ourselves.
|
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(dolist (file added)
|
(dolist (file added)
|
||||||
|
@ -537,6 +541,28 @@ files under the default directory otherwise."
|
||||||
(list diff-switches))
|
(list diff-switches))
|
||||||
(list "/dev/null"
|
(list "/dev/null"
|
||||||
file))))
|
file))))
|
||||||
|
(dolist (file deleted)
|
||||||
|
(with-temp-buffer
|
||||||
|
(p4-lowlevel-print file nil (current-buffer) :quiet)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (search-forward-regexp "^text: " nil t)
|
||||||
|
(replace-match "" nil nil))
|
||||||
|
(apply 'call-process-region
|
||||||
|
(point-min) (point-max)
|
||||||
|
diff-command
|
||||||
|
:delete
|
||||||
|
buffer
|
||||||
|
nil
|
||||||
|
(append
|
||||||
|
(list "-N"
|
||||||
|
;; Not sure this is the most useful labeling...
|
||||||
|
(concat "--label=" (vc-file-getprop file 'vc-p4-depot-file))
|
||||||
|
(concat "--label=" file))
|
||||||
|
(if (listp diff-switches)
|
||||||
|
diff-switches
|
||||||
|
(list diff-switches))
|
||||||
|
(list "-"
|
||||||
|
"/dev/null")))))
|
||||||
|
|
||||||
;; Now diff all the modified files in a single call to the server.
|
;; Now diff all the modified files in a single call to the server.
|
||||||
(when modified
|
(when modified
|
||||||
|
|
Loading…
Reference in a new issue