aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Wiberg <kha@treskal.com>2010-01-13 11:27:12 +0100
committerKarl Wiberg <kha@treskal.com>2010-01-22 14:58:34 +0100
commitc141283257195c58448688b8c22b20c988ae8acb (patch)
tree249e5e742e4be7ac608f744b256531b4a3cf5546
parent015a6dfa9abb62f661e669e7d741d8ae9369f09f (diff)
downloadstgit-c141283257195c58448688b8c22b20c988ae8acb.tar.gz
stgit.el: Optionally allow duplicates when sorting patches
Signed-off-by: Karl Wiberg <kha@treskal.com>
-rw-r--r--contrib/stgit.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el
index 9814e84..61fca79 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -2022,11 +2022,12 @@ patches."
(t (setq result :bottom)))))
result)))
-(defun stgit-sort-patches (patchsyms)
+(defun stgit-sort-patches (patchsyms &optional allow-duplicates)
"Returns the list of patches in PATCHSYMS sorted according to
their position in the patch series, bottommost first.
-PATCHSYMS must not contain duplicate entries."
+PATCHSYMS must not contain duplicate entries, unless
+ALLOW-DUPLICATES is not nil."
(let (sorted-patchsyms
(series (with-output-to-string
(with-current-buffer standard-output
@@ -2039,8 +2040,9 @@ PATCHSYMS must not contain duplicate entries."
(setq start (match-end 0)))
(setq sorted-patchsyms (nreverse sorted-patchsyms))
- (unless (= (length patchsyms) (length sorted-patchsyms))
- (error "Internal error"))
+ (unless allow-duplicates
+ (unless (= (length patchsyms) (length sorted-patchsyms))
+ (error "Internal error")))
sorted-patchsyms))