(vc-p4-registered): Don't consider a file registered if its current
action or head action is "delete". (vc-p4-register): If someone tries to register a file which is currently open for delete, offer them the choice of reverting and editing the file, possibly preserving its contents. [git-p4: depot-paths = "//guest/Ben_Key/vc-p4/,//guest/jonathan_kamens/vc-p4/,//guest/magnus_henoch/vc-p4/": change = 1266]
This commit is contained in:
parent
1e65e958c7
commit
35d746c591
1 changed files with 21 additions and 3 deletions
24
vc-p4.el
24
vc-p4.el
|
@ -348,8 +348,11 @@ specify a starting date when you run C-u C-x v g."
|
||||||
(getenv "P4CONFIG")
|
(getenv "P4CONFIG")
|
||||||
(not (vc-p4-find-p4config (file-name-directory file))))
|
(not (vc-p4-find-p4config (file-name-directory file))))
|
||||||
nil
|
nil
|
||||||
(let ((fstat (p4-lowlevel-fstat file nil t)))
|
(let* ((fstat (p4-lowlevel-fstat file nil t))
|
||||||
(if (not fstat)
|
(action (cdr (or (assoc "action" fstat)
|
||||||
|
(assoc "headAction" fstat)))))
|
||||||
|
(if (or (not fstat)
|
||||||
|
(string= action "delete"))
|
||||||
nil
|
nil
|
||||||
; This sets a bunch of VC properties
|
; This sets a bunch of VC properties
|
||||||
(vc-p4-state file fstat)
|
(vc-p4-state file fstat)
|
||||||
|
@ -471,7 +474,22 @@ special case of a Perforce file that is added but not yet committed."
|
||||||
(error "Can't specify revision when registering Perforce file."))
|
(error "Can't specify revision when registering Perforce file."))
|
||||||
(if (and comment (not (string= comment "")))
|
(if (and comment (not (string= comment "")))
|
||||||
(error "Can't specify comment when registering Perforce file."))
|
(error "Can't specify comment when registering Perforce file."))
|
||||||
(p4-lowlevel-add file))
|
(let* ((fstat (p4-lowlevel-fstat file nil t))
|
||||||
|
(action (cdr (assoc "action" fstat))))
|
||||||
|
(if (string= action "delete")
|
||||||
|
(if (yes-or-no-p
|
||||||
|
"File already opened for delete; revert and edit it? ")
|
||||||
|
(progn
|
||||||
|
(if (yes-or-no-p "Preserve current contents? ")
|
||||||
|
(let ((tempfile (format "%s.vc-register~" file)))
|
||||||
|
(rename-file file tempfile)
|
||||||
|
(p4-lowlevel-revert file)
|
||||||
|
(delete-file file)
|
||||||
|
(rename-file tempfile file))
|
||||||
|
(p4-lowlevel-revert file))
|
||||||
|
(p4-lowlevel-edit file))
|
||||||
|
(error "File %s already opened for delete." file))
|
||||||
|
(p4-lowlevel-add file))))
|
||||||
|
|
||||||
(defun vc-p4-init-version ()
|
(defun vc-p4-init-version ()
|
||||||
"Returns `1', the default initial version for Perforce files."
|
"Returns `1', the default initial version for Perforce files."
|
||||||
|
|
Loading…
Reference in a new issue