Show More
@@ -64,6 +64,7 b'' | |||||
64 | (define-key mq-global-map "<" 'mq-pop-all) |
|
64 | (define-key mq-global-map "<" 'mq-pop-all) | |
65 | (define-key mq-global-map "r" 'mq-refresh) |
|
65 | (define-key mq-global-map "r" 'mq-refresh) | |
66 | (define-key mq-global-map "e" 'mq-refresh-edit) |
|
66 | (define-key mq-global-map "e" 'mq-refresh-edit) | |
|
67 | (define-key mq-global-map "i" 'mq-new) | |||
67 | (define-key mq-global-map "n" 'mq-next) |
|
68 | (define-key mq-global-map "n" 'mq-next) | |
68 | (define-key mq-global-map "p" 'mq-previous) |
|
69 | (define-key mq-global-map "p" 'mq-previous) | |
69 | (define-key mq-global-map "t" 'mq-top) |
|
70 | (define-key mq-global-map "t" 'mq-top) | |
@@ -80,12 +81,12 b'' | |||||
80 |
|
81 | |||
81 | ;;; Helper functions. |
|
82 | ;;; Helper functions. | |
82 |
|
83 | |||
83 | (defun mq-read-patch-name (&optional source prompt) |
|
84 | (defun mq-read-patch-name (&optional source prompt force) | |
84 | "Read a patch name to use with a command. |
|
85 | "Read a patch name to use with a command. | |
85 | May return nil, meaning \"use the default\"." |
|
86 | May return nil, meaning \"use the default\"." | |
86 | (let ((patches (split-string |
|
87 | (let ((patches (split-string | |
87 | (hg-chomp (hg-run0 (or source "qseries"))) "\n"))) |
|
88 | (hg-chomp (hg-run0 (or source "qseries"))) "\n"))) | |
88 | (when current-prefix-arg |
|
89 | (when force | |
89 | (completing-read (format "Patch%s: " (or prompt "")) |
|
90 | (completing-read (format "Patch%s: " (or prompt "")) | |
90 | (map 'list 'cons patches patches) |
|
91 | (map 'list 'cons patches patches) | |
91 | nil |
|
92 | nil | |
@@ -120,7 +121,8 b' May return nil, meaning \\"use the defaul' | |||||
120 | (defun mq-push (&optional patch) |
|
121 | (defun mq-push (&optional patch) | |
121 | "Push patches until PATCH is reached. |
|
122 | "Push patches until PATCH is reached. | |
122 | If PATCH is nil, push at most one patch." |
|
123 | If PATCH is nil, push at most one patch." | |
123 |
(interactive (list (mq-read-patch-name "qunapplied" " to push" |
|
124 | (interactive (list (mq-read-patch-name "qunapplied" " to push" | |
|
125 | current-prefix-arg))) | |||
124 | (let ((root (hg-root)) |
|
126 | (let ((root (hg-root)) | |
125 | (prev-buf (current-buffer)) |
|
127 | (prev-buf (current-buffer)) | |
126 | last-line ok) |
|
128 | last-line ok) | |
@@ -158,7 +160,8 b' If PATCH is nil, push at most one patch.' | |||||
158 | (defun mq-pop (&optional patch) |
|
160 | (defun mq-pop (&optional patch) | |
159 | "Pop patches until PATCH is reached. |
|
161 | "Pop patches until PATCH is reached. | |
160 | If PATCH is nil, pop at most one patch." |
|
162 | If PATCH is nil, pop at most one patch." | |
161 |
(interactive (list (mq-read-patch-name "qapplied" " to pop to" |
|
163 | (interactive (list (mq-read-patch-name "qapplied" " to pop to" | |
|
164 | current-prefix-arg))) | |||
162 | (let ((root (hg-root)) |
|
165 | (let ((root (hg-root)) | |
163 | last-line ok) |
|
166 | last-line ok) | |
164 | (unless root |
|
167 | (unless root | |
@@ -318,6 +321,22 b' Key bindings' | |||||
318 | (cd root))) |
|
321 | (cd root))) | |
319 | (message "Type `C-c C-c' to finish editing and refresh the patch.")) |
|
322 | (message "Type `C-c C-c' to finish editing and refresh the patch.")) | |
320 |
|
323 | |||
|
324 | (defun mq-new (name) | |||
|
325 | "Create a new empty patch named NAME. | |||
|
326 | The patch is applied on top of the current topmost patch. | |||
|
327 | With a prefix argument, forcibly create the patch even if the working | |||
|
328 | directory is modified." | |||
|
329 | (interactive (list (mq-read-patch-name "qseries" " to create" t))) | |||
|
330 | (message "Creating patch...") | |||
|
331 | (let ((ret (if current-prefix-arg | |||
|
332 | (hg-run "qnew" "-f" name) | |||
|
333 | (hg-run "qnew" name)))) | |||
|
334 | (if (equal (car ret) 0) | |||
|
335 | (progn | |||
|
336 | (hg-update-mode-lines (buffer-file-name)) | |||
|
337 | (message "Creating patch... done.")) | |||
|
338 | (error "Creating patch... %s" (hg-chomp (cdr ret)))))) | |||
|
339 | ||||
321 |
|
340 | |||
322 | (provide 'mq) |
|
341 | (provide 'mq) | |
323 |
|
342 |
General Comments 0
You need to be logged in to leave comments.
Login now