;; * find-revision (file rev buffer) OK
;; * checkout (file &optional editable rev) OK
;; * revert (file &optional contents-done) OK
-;; - rollback (files) ?? PROBABLY NOT NEEDED
+;; - rollback (files) ?? PROBABLY NOT NEEDED
;; - merge (file rev1 rev2) NEEDED
;; - merge-news (file) NEEDED
;; - steal-lock (file &optional revision) NOT NEEDED
;; - retrieve-snapshot (dir name update) ?? NEEDED??
;; MISCELLANEOUS
;; - make-version-backups-p (file) ??
-;; - repository-hostname (dirname) ??
+;; - repository-hostname (dirname) ??
;; - previous-revision (file rev) OK
;; - next-revision (file rev) OK
;; - check-headers () ??
(defun vc-hg-state (file)
"Hg-specific version of `vc-state'."
- (let*
+ (let*
((status nil)
(out
(with-output-to-string
(let ((state (aref out 0)))
(cond
((eq state ?=) 'up-to-date)
- ((eq state ?A) 'edited)
+ ((eq state ?A) 'added)
((eq state ?M) 'edited)
((eq state ?I) 'ignored)
- ((eq state ?R) 'unregistered)
+ ((eq state ?R) 'removed)
+ ((eq state ?!) 'missing)
((eq state ??) 'unregistered)
((eq state ?C) 'up-to-date) ;; Older mercurials use this
(t 'up-to-date)))))))
(file nil))
(while (not (eobp))
(setq status-char (char-after))
- (setq file
+ (setq file
(expand-file-name
- (buffer-substring-no-properties (+ (point) 2)
+ (buffer-substring-no-properties (+ (point) 2)
(line-end-position))))
(cond
;; State flag for a clean file is now C, might change to =.
(vc-file-setprop file 'vc-backend 'none)
(vc-file-setprop file 'vc-state 'unregistered))
((eq status-char ?!)
- nil)
+ (vc-file-setprop file 'vc-backend 'Hg)
+ (vc-file-setprop file 'vc-state 'missing))
(t ;; Presently C, might change to = in 0.9.6
(vc-file-setprop file 'vc-backend 'Hg)
(vc-file-setprop file 'vc-state 'up-to-date)))
(defun vc-hg-working-revision (file)
"Hg-specific version of `vc-working-revision'."
- (let*
+ (let*
((status nil)
(out
(with-output-to-string
;; If the buffer exists from a previous invocation it might be
;; read-only.
(let ((inhibit-read-only t))
- ;; We need to loop and call "hg log" on each file separately.
+ ;; We need to loop and call "hg log" on each file separately.
;; "hg log" with multiple file arguments mashes all the logs
;; together. Ironically enough, this puts us back near CVS
;; which can't generate proper fileset logs either.
(1 'change-log-name)
(2 'change-log-email))
;; Handle the cases:
- ;; user: foo@bar
- ;; and
+ ;; user: foo@bar
+ ;; and
;; user: foo
("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
(1 'change-log-email))
(let ((default-directory (file-name-directory (car files))))
(with-temp-buffer
(vc-hg-command t nil files "log" "--template" "{rev} ")
- (split-string
+ (split-string
(buffer-substring-no-properties (point-min) (point-max))))))
;; Modelled after the similar function in vc-cvs.el
(defun vc-hg-next-revision (file rev)
(let ((newrev (1+ (string-to-number rev)))
- (tip-revision
+ (tip-revision
(with-temp-buffer
(vc-hg-command t 0 nil "tip")
(goto-char (point-min))
(defun vc-hg-workfile-unchanged-p (file)
(eq 'up-to-date (vc-hg-state file)))
-(defun vc-hg-dired-state-info (file)
- "Hg-specific version of `vc-dired-state-info'."
- (let ((hg-state (vc-state file)))
- (if (eq hg-state 'edited)
- (if (equal (vc-working-revision file) "0")
- "(added)" "(modified)")
- ;; fall back to the default VC representation
- (vc-default-dired-state-info 'Hg file))))
-
;; Modelled after the similar function in vc-bzr.el
(defun vc-hg-revert (file &optional contents-done)
(unless contents-done
;;; Hg specific functionality.
-;;; XXX This functionality is experimental/work in progress. It might
-;;; change without notice.
+;; XXX This functionality is experimental/work in progress. It might
+;; change without notice.
(defvar vc-hg-extra-menu-map
(let ((map (make-sparse-keymap)))
(define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
(defun vc-hg-extra-menu () vc-hg-extra-menu-map)
+(defun vc-hg-extra-status-menu () vc-hg-extra-menu-map)
+
(define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing")
(define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming")
;; XXX Experimental function for the vc-dired replacement.
-(defun vc-hg-after-dir-status (update-function buff)
+(defun vc-hg-after-dir-status (update-function)
(let ((status-char nil)
(file nil)
(translation '((?= . up-to-date)
(?R . removed)
(?M . edited)
(?I . ignored)
- (?! . deleted)
+ (?! . missing)
(?? . unregistered)))
(translated nil)
- (result nil))
+ (result nil))
(goto-char (point-min))
(while (not (eobp))
(setq status-char (char-after))
- (setq file
- (buffer-substring-no-properties (+ (point) 2)
+ (setq file
+ (buffer-substring-no-properties (+ (point) 2)
(line-end-position)))
(setq translated (assoc status-char translation))
(when (and translated (not (eq (cdr translated) 'up-to-date)))
- (push (cons file (cdr translated)) result))
+ (push (list file (cdr translated)) result))
(forward-line))
- (funcall update-function result buff)))
+ (funcall update-function result)))
;; XXX Experimental function for the vc-dired replacement.
-(defun vc-hg-dir-status (dir update-function status-buffer)
- "Return a list of conses (file . state) for DIR."
- (with-current-buffer
- (get-buffer-create
- (expand-file-name " *VC-hg* tmp status" dir))
- (vc-hg-command (current-buffer) 'async dir "status")
- (vc-exec-after
- `(vc-hg-after-dir-status (quote ,update-function) ,status-buffer))))
+(defun vc-hg-dir-status (dir update-function)
+ (vc-hg-command (current-buffer) 'async dir "status")
+ (vc-exec-after
+ `(vc-hg-after-dir-status (quote ,update-function))))
;; XXX this adds another top level menu, instead figure out how to
;; replace the Log-View menu.
(interactive)
(let ((marked-list (log-view-get-marked)))
(if marked-list
- (vc-hg-command
+ (vc-hg-command
nil 0 nil
(cons "push"
(apply 'nconc
(interactive)
(let ((marked-list (log-view-get-marked)))
(if marked-list
- (vc-hg-command
+ (vc-hg-command
nil 0 nil
(cons "pull"
(apply 'nconc