# # patch "ChangeLog" # from [4b197b628dc730956dcab0fbceba9fa1ccaee522] # to [e76c3e9f91c0fcf0e9eda99f8f40f34175999285] # # patch "contrib/monotone.el" # from [e4dab598c21173cb6b46320982cb2f115e88cea4] # to [9e1a1ec218b98cd38c6126c48f00a1d585e65a13] # ======================================================================== --- ChangeLog 4b197b628dc730956dcab0fbceba9fa1ccaee522 +++ ChangeLog e76c3e9f91c0fcf0e9eda99f8f40f34175999285 @@ -1,3 +1,11 @@ +2005-08-23 Olivier Andrieu + + * contrib/monotone.el: When running monotone commands, re-use + *monotone* buffers. Make the "status" command use the prefix + argument. Make the "tree"-restricted commands work in dired + buffers. Add the "--no-merges" option in the log command. Various + other innocuous changes. + 2005-08-22 Nathaniel Smith * mt_version.cc (print_full_version): Typo. ======================================================================== --- contrib/monotone.el e4dab598c21173cb6b46320982cb2f115e88cea4 +++ contrib/monotone.el 9e1a1ec218b98cd38c6126c48f00a1d585e65a13 @@ -228,7 +228,7 @@ (defun monotone-find-MT-top (&optional path) "Find the directory which contains the 'MT' directory. Optional argument PATH ." - (setq path (or path (buffer-file-name) default-directory)) + (setq path (or path buffer-file-name default-directory)) (when (null path) (error "Cant find top for %s" path)) ;; work with full path names @@ -487,7 +487,7 @@ (interactive "p") (setq args (monotone-arg-decode args)) (when (eq args 'file) - (when (not (setq args (buffer-file-name))) + (when (not (setq args buffer-file-name)) (error "Cant commit a buffer without a filename"))) ;; dont run two processes (when (monotone-cmd-is-running) @@ -603,7 +603,7 @@ (defun monotone-arg-decode (arg) "Decode the ARG into the scope monotone should work on." (interactive "p") - (message "%s" arg) + (monotone-msg "%s" arg) (cond ((member arg '(global tree file)) arg) ;; identity ((= arg 1) 'global) @@ -641,21 +641,26 @@ (monotone-cmd cmds)) ;; path/. ((eq prefix 'tree) - (let ((path (buffer-file-name buf))) - (when (not path) - (error "This buffer is not a file")) - (setq - path (concat (file-name-directory (monotone-extract-MT-path path)) ".")) + (let ((path (monotone-extract-MT-path + (with-current-buffer buf default-directory)))) + (unless path + (error "No directory")) (monotone-cmd (append cmds (list path))))) ;; path/file ((eq prefix 'file) (let ((name (buffer-file-name buf))) - (if name - (monotone-cmd (append cmds (list (monotone-extract-MT-path name)))) - (error "This buffer is not a file")))) + (unless name + (error "This buffer is not a file")) + (setq name (monotone-extract-MT-path name)) + (monotone-cmd (append cmds (list name))))) (t (error "Bad prefix")))) +(defmacro replace-buffer (name) + `(let ((buf (get-buffer ,name))) + (when buf (kill-buffer buf)) + (rename-buffer ,name))) + ;; runs the command without the buffer. ;; (let ((bfn (buffer-file-name))) ;; (when (not bfn) @@ -681,27 +686,29 @@ (when (eq 'tree (monotone-arg-decode arg)) (error "monotone subtree log is busted")) ;; - (let ((cmds (list "log")) + (let ((cmds (list "log" "--no-merges")) (depth monotone-log-depth)) (when (and (numberp depth) (< 0 depth)) (setq cmds (append cmds (list (format "--last=%d" depth))))) (monotone-cmd-buf arg cmds) - (rename-buffer "*monotone log*" t))) + (replace-buffer "*monotone log*"))) ;; (monotone-vc-print-log) (defun monotone-vc-diff (&optional arg) "Print the diffs for this buffer. With prefix ARG, the global diffs." (interactive "p") (save-some-buffers) - (let ((what (monotone-arg-decode arg)) - (name (buffer-file-name))) + (let* ((what (monotone-arg-decode arg)) + (target-buffer-name + (format "*monotone diff %s*" + (cond + ((eq what 'file) + (monotone-extract-MT-path buffer-file-name)) + (t what))))) (monotone-cmd-buf what '("diff")) (diff-mode) - (rename-buffer - (format "*monotone diff %s*" - (cond - ((eq what 'file) (monotone-extract-MT-path name)) - (t what))) t))) + ;; dont duplicate the buffers + (replace-buffer target-buffer-name))) (defun monotone-vc-register () "Register this file with monotone for the next commit." @@ -710,10 +717,11 @@ (monotone-cmd-buf 'file '("add") (current-buffer)) (error "This buffer does not have a file name"))) -(defun monotone-vc-status () +(defun monotone-vc-status (&optional arg) "Print the status of the current branch." - (interactive) - (monotone-cmd "status")) + (interactive "p") + (save-some-buffers) + (monotone-cmd-buf arg '("status"))) (defun monotone-vc-update-change-log () "Edit the monotone change log." @@ -771,9 +779,7 @@ ;; remember it (setq monotone-last-id id) ;; dont duplicate the buffers - (if (get-buffer name) - (kill-buffer name)) - (rename-buffer name)))) + (replace-buffer name)))) (defun monotone-cat-id-pd (what id default) "A helper function."