Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/mercurial.el @ 1024:5b257e419816
Sync buffers prior to doing a diff.
author | bos@serpentine.internal.keyresearch.com |
---|---|
date | Tue, 23 Aug 2005 15:27:17 -0700 |
parents | d06420c90d8b |
children | a5539638c5a3 |
comparison
equal
deleted
inserted
replaced
1011:d06420c90d8b | 1024:5b257e419816 |
---|---|
45 | 45 |
46 (require 'advice) | 46 (require 'advice) |
47 (require 'cl) | 47 (require 'cl) |
48 (require 'diff-mode) | 48 (require 'diff-mode) |
49 (require 'easymenu) | 49 (require 'easymenu) |
50 (require 'executable) | |
50 (require 'vc) | 51 (require 'vc) |
51 | 52 |
52 | 53 |
53 ;;; XEmacs has view-less, while GNU Emacs has view. Joy. | 54 ;;; XEmacs has view-less, while GNU Emacs has view. Joy. |
54 | 55 |
293 (error "Mercurial command failed %s - exit code %s" | 294 (error "Mercurial command failed %s - exit code %s" |
294 (cons command args) | 295 (cons command args) |
295 (car res)) | 296 (car res)) |
296 (cdr res)))) | 297 (cdr res)))) |
297 | 298 |
299 (defun hg-sync-buffers (path) | |
300 "Sync buffers visiting PATH with their on-disk copies. | |
301 If PATH is not being visited, but is under the repository root, sync | |
302 all buffers visiting files in the repository." | |
303 (let ((buf (find-buffer-visiting path))) | |
304 (if buf | |
305 (with-current-buffer buf | |
306 (vc-buffer-sync)) | |
307 (hg-do-across-repo path | |
308 (vc-buffer-sync))))) | |
309 | |
298 (defun hg-buffer-commands (pnt) | 310 (defun hg-buffer-commands (pnt) |
299 "Use the properties of a character to do something sensible." | 311 "Use the properties of a character to do something sensible." |
300 (interactive "d") | 312 (interactive "d") |
301 (let ((rev (get-char-property pnt 'rev)) | 313 (let ((rev (get-char-property pnt 'rev)) |
302 (file (get-char-property pnt 'file)) | 314 (file (get-char-property pnt 'file)) |
730 (let ((root (hg-root)) | 742 (let ((root (hg-root)) |
731 (prev-buffer (current-buffer)) | 743 (prev-buffer (current-buffer)) |
732 modified-files) | 744 modified-files) |
733 (unless root | 745 (unless root |
734 (error "Cannot commit outside a repository!")) | 746 (error "Cannot commit outside a repository!")) |
735 (hg-do-across-repo | 747 (hg-sync-buffers root) |
736 (vc-buffer-sync)) | |
737 (setq modified-files (hg-chomp (hg-run0 "--cwd" root "status" "-arm"))) | 748 (setq modified-files (hg-chomp (hg-run0 "--cwd" root "status" "-arm"))) |
738 (when (and (= (length modified-files) 0) | 749 (when (and (= (length modified-files) 0) |
739 (not hg-commit-allow-empty-file-list)) | 750 (not hg-commit-allow-empty-file-list)) |
740 (error "No pending changes to commit")) | 751 (error "No pending changes to commit")) |
741 (let* ((buf-name (format "*Mercurial: Commit %s*" root))) | 752 (let* ((buf-name (format "*Mercurial: Commit %s*" root))) |
787 (hg-read-rev " to start with") | 798 (hg-read-rev " to start with") |
788 (let ((rev2 (hg-read-rev " to end with" 'working-dir))) | 799 (let ((rev2 (hg-read-rev " to end with" 'working-dir))) |
789 (and (not (eq rev2 'working-dir)) rev2)))) | 800 (and (not (eq rev2 'working-dir)) rev2)))) |
790 (unless rev1 | 801 (unless rev1 |
791 (setq rev1 "-1")) | 802 (setq rev1 "-1")) |
803 (hg-sync-buffers path) | |
792 (let ((a-path (hg-abbrev-file-name path)) | 804 (let ((a-path (hg-abbrev-file-name path)) |
793 diff) | 805 diff) |
794 (hg-view-output ((if (equal rev1 rev2) | 806 (hg-view-output ((if (equal rev1 rev2) |
795 (format "Mercurial: Rev %s of %s" rev1 a-path) | 807 (format "Mercurial: Rev %s of %s" rev1 a-path) |
796 (format "Mercurial: Rev %s to %s of %s" | 808 (format "Mercurial: Rev %s to %s of %s" |