From c141283257195c58448688b8c22b20c988ae8acb Mon Sep 17 00:00:00 2001 From: Karl Wiberg Date: Wed, 13 Jan 2010 11:27:12 +0100 Subject: [PATCH] stgit.el: Optionally allow duplicates when sorting patches Signed-off-by: Karl Wiberg --- contrib/stgit.el | 10 ++++++---- 1 file 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)) -- 2.11.0