emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109636: * lisp/vc/vc-mtn.el (vc-mtn-


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109636: * lisp/vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion
Date: Wed, 15 Aug 2012 15:20:26 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109636
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2012-08-15 15:20:26 -0400
message:
  * lisp/vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion
  for composite selectors.
  * lisp/vc/vc.el (vc-diff-build-argument-list-internal): Don't prevent
  operation just because we can't find a previous revision.
modified:
  lisp/ChangeLog
  lisp/vc/vc-mtn.el
  lisp/vc/vc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-08-15 07:58:34 +0000
+++ b/lisp/ChangeLog    2012-08-15 19:20:26 +0000
@@ -1,3 +1,10 @@
+2012-08-15  Stefan Monnier  <address@hidden>
+
+       * vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion
+       for composite selectors.
+       * vc/vc.el (vc-diff-build-argument-list-internal): Don't prevent
+       operation just because we can't find a previous revision.
+
 2012-08-15  Chong Yidong  <address@hidden>
 
        * frame.el (set-frame-font): Accept font objects.

=== modified file 'lisp/vc/vc-mtn.el'
--- a/lisp/vc/vc-mtn.el 2012-07-11 23:13:41 +0000
+++ b/lisp/vc/vc-mtn.el 2012-08-15 19:20:26 +0000
@@ -305,29 +305,28 @@
       ids)))
 
 (defun vc-mtn-revision-completion-table (_files)
-  ;; TODO: Implement completion for selectors
-  ;; TODO: Implement completion for composite selectors.
   ;; What about using `files'?!?  --Stef
   (lambda (string pred action)
     (cond
+     ;; Special chars for composite selectors.
+     ((string-match ".*[^\\]\\(\\\\\\\\\\)*[/|;(]" string)
+      (completion-table-with-context (substring string 0 (match-end 0))
+                                     (vc-mtn-revision-completion-table nil)
+                                     (substring string (match-end 0))
+                                     pred action))
      ;; "Tag" selectors.
      ((string-match "\\`t:" string)
       (complete-with-action action
                             (mapcar (lambda (tag) (concat "t:" tag))
                                     (vc-mtn-list-tags))
                             string pred))
-     ;; "Branch" selectors.
-     ((string-match "\\`b:" string)
-      (complete-with-action action
-                            (mapcar (lambda (tag) (concat "b:" tag))
-                                    (vc-mtn-list-branches))
-                            string pred))
-     ;; "Head" selectors.  Not sure how they differ from "branch" selectors.
-     ((string-match "\\`h:" string)
-      (complete-with-action action
-                            (mapcar (lambda (tag) (concat "h:" tag))
-                                    (vc-mtn-list-branches))
-                            string pred))
+     ;; "Branch" or "Head" selectors.
+     ((string-match "\\`[hb]:" string)
+      (let ((prefix (match-string 0 string)))
+        (complete-with-action action
+                              (mapcar (lambda (tag) (concat prefix tag))
+                                      (vc-mtn-list-branches))
+                              string pred)))
      ;; "ID" selectors.
      ((string-match "\\`i:" string)
       (complete-with-action action
@@ -339,7 +338,13 @@
       (complete-with-action action
                             '("t:" "b:" "h:" "i:"
                               ;; Completion not implemented for these.
-                              "a:" "c:" "d:" "e:" "l:")
+                              "c:" "a:" "k:" "d:" "m:" "e:" "l:" "i:" "p:"
+                              ;; These have no arg to complete.
+                              "u:" "w:"
+                              ;; Selector functions.
+                              "difference(" "lca(" "max(" "ancestors("
+                              "descendants(" "parents(" "children("
+                              "pick(")
                             string pred)))))
 
 

=== modified file 'lisp/vc/vc.el'
--- a/lisp/vc/vc.el     2012-08-15 16:29:11 +0000
+++ b/lisp/vc/vc.el     2012-08-15 19:20:26 +0000
@@ -1652,8 +1652,9 @@
       (setq rev1-default (vc-working-revision first)))
      ;; if the file is not locked, use last and previous revisions as defaults
      (t
-      (setq rev1-default (vc-call-backend backend 'previous-revision first
-                                          (vc-working-revision first)))
+      (setq rev1-default (ignore-errors ;If `previous-revision' doesn't work.
+                           (vc-call-backend backend 'previous-revision first
+                                            (vc-working-revision first))))
       (when (string= rev1-default "") (setq rev1-default nil))
       (setq rev2-default (vc-working-revision first))))
     ;; construct argument list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]