# HG changeset patch # User bos@serpentine.internal.keyresearch.com # Date 1124836037 25200 # Node ID 5b257e419816f2059174b44528808a35464e7efe # Parent d06420c90d8b9da709daf6aa5302ebe09ad707d4 Sync buffers prior to doing a diff. diff -r d06420c90d8b -r 5b257e419816 contrib/mercurial.el --- a/contrib/mercurial.el Tue Aug 23 14:51:52 2005 -0700 +++ b/contrib/mercurial.el Tue Aug 23 15:27:17 2005 -0700 @@ -47,6 +47,7 @@ (require 'cl) (require 'diff-mode) (require 'easymenu) +(require 'executable) (require 'vc) @@ -295,6 +296,17 @@ (car res)) (cdr res)))) +(defun hg-sync-buffers (path) + "Sync buffers visiting PATH with their on-disk copies. +If PATH is not being visited, but is under the repository root, sync +all buffers visiting files in the repository." + (let ((buf (find-buffer-visiting path))) + (if buf + (with-current-buffer buf + (vc-buffer-sync)) + (hg-do-across-repo path + (vc-buffer-sync))))) + (defun hg-buffer-commands (pnt) "Use the properties of a character to do something sensible." (interactive "d") @@ -732,8 +744,7 @@ modified-files) (unless root (error "Cannot commit outside a repository!")) - (hg-do-across-repo - (vc-buffer-sync)) + (hg-sync-buffers root) (setq modified-files (hg-chomp (hg-run0 "--cwd" root "status" "-arm"))) (when (and (= (length modified-files) 0) (not hg-commit-allow-empty-file-list)) @@ -789,6 +800,7 @@ (and (not (eq rev2 'working-dir)) rev2)))) (unless rev1 (setq rev1 "-1")) + (hg-sync-buffers path) (let ((a-path (hg-abbrev-file-name path)) diff) (hg-view-output ((if (equal rev1 rev2)