Fix ‘vc-p4-checkin’
- The arguments ‘comment’ and ‘rev’ have been switched. I don’t know if this used to be different from how it is now, but ‘rev’ comes last now and is optional. - The ‘vc-p4-client’ needs to be collected from the first file in the list of files to check in because ‘vc-p4-checkin’ is called from a different buffer that isn’t in the same directory. - ‘vc-p4-client’ also needs to be stored under a different name so that when it changes to the ‘*p4-lowlevel-changes*’ buffer it doesn’t clear the value. - Instead of inserting the specified comment directly, send it through ‘log-edit-extract-headers’ which removes the "Summary: " header that ‘vc-log-edit’ adds. - Indent rigidly to ‘tab-width’ instead of 8. Indenting to 8 added too many tabs to the description and caused all lines to be prefixed by a tab.
This commit is contained in:
parent
79262464fd
commit
39efc77e07
1 changed files with 10 additions and 7 deletions
17
vc-p4.el
17
vc-p4.el
|
@ -296,14 +296,17 @@ administered by Perforce."
|
||||||
:quiet t
|
:quiet t
|
||||||
:client vc-p4-client))
|
:client vc-p4-client))
|
||||||
|
|
||||||
(defun vc-p4-checkin (files rev comment)
|
(defun vc-p4-checkin (files comment &optional rev)
|
||||||
"Check FILES into Perforce. Error if REV is non-nil. Check in with
|
"Check FILES into Perforce. Error if REV is non-nil. Check in with
|
||||||
comment COMMENT."
|
comment COMMENT."
|
||||||
(if rev
|
(if rev
|
||||||
(error "Can't specify revision for Perforce checkin."))
|
(error "Can't specify revision for Perforce checkin."))
|
||||||
(let* (;; XXX: default-directory? this should work for most (all?) cases
|
(let* (;; XXX: default-directory? this should work for most (all?) cases
|
||||||
(default-directory (file-name-directory (car files)))
|
(default-directory (file-name-directory (car files)))
|
||||||
(change-buffer (p4-lowlevel-change :client vc-p4-client))
|
(current-client
|
||||||
|
(with-current-buffer (find-file-noselect (car files))
|
||||||
|
vc-p4-client))
|
||||||
|
(change-buffer (p4-lowlevel-change :client current-client))
|
||||||
(indent-tabs-mode 1)
|
(indent-tabs-mode 1)
|
||||||
insertion-start change-number)
|
insertion-start change-number)
|
||||||
(dolist (file files)
|
(dolist (file files)
|
||||||
|
@ -315,8 +318,8 @@ comment COMMENT."
|
||||||
(re-search-forward "^Description:\\s-*\n")
|
(re-search-forward "^Description:\\s-*\n")
|
||||||
(kill-line 1)
|
(kill-line 1)
|
||||||
(setq insertion-start (point))
|
(setq insertion-start (point))
|
||||||
(insert comment "\n")
|
(insert (car (log-edit-extract-headers nil comment)) "\n")
|
||||||
(indent-rigidly insertion-start (point) 8)
|
(indent-rigidly insertion-start (point) tab-width)
|
||||||
(re-search-forward "^Files:\\s-*\n")
|
(re-search-forward "^Files:\\s-*\n")
|
||||||
(delete-region (point) (point-max))
|
(delete-region (point) (point-max))
|
||||||
(dolist (file files)
|
(dolist (file files)
|
||||||
|
@ -324,12 +327,12 @@ comment COMMENT."
|
||||||
(setq change-number (p4-lowlevel-change
|
(setq change-number (p4-lowlevel-change
|
||||||
:buffer (current-buffer)
|
:buffer (current-buffer)
|
||||||
:op t
|
:op t
|
||||||
:client vc-p4-client))
|
:client current-client))
|
||||||
(p4-lowlevel-change
|
(p4-lowlevel-change
|
||||||
:buffer (current-buffer)
|
:buffer (current-buffer)
|
||||||
:op change-number
|
:op change-number
|
||||||
:client vc-p4-client)
|
:client current-client)
|
||||||
(p4-lowlevel-submit (current-buffer) :client vc-p4-client)
|
(p4-lowlevel-submit (current-buffer) :client current-client)
|
||||||
; Update its properties
|
; Update its properties
|
||||||
(dolist (file files)
|
(dolist (file files)
|
||||||
(vc-p4-state file nil t)))))
|
(vc-p4-state file nil t)))))
|
||||||
|
|
Loading…
Reference in a new issue