From: Karl Wiberg Date: Wed, 13 Jan 2010 10:27:12 +0000 (+0100) Subject: stgit.el: Optionally allow duplicates when sorting patches X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/c141283257195c58448688b8c22b20c988ae8acb stgit.el: Optionally allow duplicates when sorting patches Signed-off-by: Karl Wiberg --- 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))