diff options
| author | Joakim Verona | 2012-12-05 02:55:18 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-12-05 02:55:18 +0100 |
| commit | 2359398421287ca01e37fa9e0934b0afff961135 (patch) | |
| tree | 9ac094b2c42c5352e6181b27ec958df5c6557ddd | |
| parent | fd985332de9e5d856acdbc9966f877a47303b9fa (diff) | |
| parent | 49596095d09227d828ffb6fed955ba0b660b4d92 (diff) | |
| download | emacs-2359398421287ca01e37fa9e0934b0afff961135.tar.gz emacs-2359398421287ca01e37fa9e0934b0afff961135.zip | |
auto upstream
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc/vc-hg.el | 31 |
2 files changed, 35 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff9b0e2a86f..45fa38042a0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-12-05 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * vc/vc-hg.el (vc-hg-resolve-when-done, vc-hg-find-file-hook): | ||
| 4 | New functions, for detecting and resolving conflicts. (Bug#10709) | ||
| 5 | |||
| 1 | 2012-12-04 Jambunathan K <kjambunathan@gmail.com> | 6 | 2012-12-04 Jambunathan K <kjambunathan@gmail.com> |
| 2 | 7 | ||
| 3 | * hi-lock.el (hi-lock-auto-select-face): New user variable. | 8 | * hi-lock.el (hi-lock-auto-select-face): New user variable. |
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 50678fad075..a240fdeb658 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el | |||
| @@ -93,7 +93,7 @@ | |||
| 93 | ;; - clear-headers () ?? | 93 | ;; - clear-headers () ?? |
| 94 | ;; - delete-file (file) TEST IT | 94 | ;; - delete-file (file) TEST IT |
| 95 | ;; - rename-file (old new) OK | 95 | ;; - rename-file (old new) OK |
| 96 | ;; - find-file-hook () PROBABLY NOT NEEDED | 96 | ;; - find-file-hook () added for bug#10709 |
| 97 | 97 | ||
| 98 | ;; 2) Implement Stefan Monnier's advice: | 98 | ;; 2) Implement Stefan Monnier's advice: |
| 99 | ;; vc-hg-registered and vc-hg-state | 99 | ;; vc-hg-registered and vc-hg-state |
| @@ -464,6 +464,35 @@ REV is the revision to check out into WORKFILE." | |||
| 464 | (vc-hg-command t 0 file "cat" "-r" rev) | 464 | (vc-hg-command t 0 file "cat" "-r" rev) |
| 465 | (vc-hg-command t 0 file "cat"))))) | 465 | (vc-hg-command t 0 file "cat"))))) |
| 466 | 466 | ||
| 467 | (defun vc-hg-resolve-when-done () | ||
| 468 | "Call \"hg resolve -m\" if the conflict markers have been removed." | ||
| 469 | (save-excursion | ||
| 470 | (goto-char (point-min)) | ||
| 471 | (unless (re-search-forward "^<<<<<<< " nil t) | ||
| 472 | (vc-hg-command nil 0 buffer-file-name "resolve" "-m") | ||
| 473 | ;; Remove the hook so that it is not called multiple times. | ||
| 474 | (remove-hook 'after-save-hook 'vc-hg-resolve-when-done t)))) | ||
| 475 | |||
| 476 | (defun vc-hg-find-file-hook () | ||
| 477 | (when (and buffer-file-name | ||
| 478 | (file-exists-p (concat buffer-file-name ".orig")) | ||
| 479 | ;; Hg does not seem to have a "conflict" status, eg | ||
| 480 | ;; hg http://bz.selenic.com/show_bug.cgi?id=2724 | ||
| 481 | (memq (vc-file-getprop buffer-file-name 'vc-state) | ||
| 482 | '(edited conflict)) | ||
| 483 | ;; Maybe go on to check that "hg resolve -l" says "U"? | ||
| 484 | ;; If "hg resolve -l" says there's a conflict but there are no | ||
| 485 | ;; conflict markers, it's not clear what we should do. | ||
| 486 | (save-excursion | ||
| 487 | (goto-char (point-min)) | ||
| 488 | (re-search-forward "^<<<<<<< " nil t))) | ||
| 489 | ;; Hg may not recognize "conflict" as a state, but we can do better. | ||
| 490 | (vc-file-setprop buffer-file-name 'vc-state 'conflict) | ||
| 491 | (smerge-start-session) | ||
| 492 | (add-hook 'after-save-hook 'vc-hg-resolve-when-done nil t) | ||
| 493 | (message "There are unresolved conflicts in this file"))) | ||
| 494 | |||
| 495 | |||
| 467 | ;; Modeled after the similar function in vc-bzr.el | 496 | ;; Modeled after the similar function in vc-bzr.el |
| 468 | (defun vc-hg-workfile-unchanged-p (file) | 497 | (defun vc-hg-workfile-unchanged-p (file) |
| 469 | (eq 'up-to-date (vc-hg-state file))) | 498 | (eq 'up-to-date (vc-hg-state file))) |