From dea5d6f8cbd86916ec5373fb704c67e1a33e29a8 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 16 Sep 2013 14:52:01 +0000 Subject: foreach: sort repositories asciibetically The test suite checks the output of the foreach command, this requires repositories to be returned in a stable order. The order returned from os.listdir differs by the filesystem used. btrfs returns roughly in insertion order, tmpfs alphabetically. This allowed the failure to sort pass through unchecked, since I was testing on btrfs, but people discovered issues when using /tmp, which is a tmpfs. To fix this, foreach sorts the result of list_git_directories() by directory name. The previous code would always return the root repository first, this was a unnecessary complication, so now everything is returned asciibetically and the tests amended to reflect this. --- morphlib/plugins/branch_and_merge_new_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'morphlib') diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 98e675f1..61cd40c0 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -581,7 +581,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): ws = morphlib.workspace.open('.') sb = morphlib.sysbranchdir.open_from_within('.') - for gd in sb.list_git_directories(): + for gd in sorted(sb.list_git_directories(), key=lambda gd: gd.dirname): # Get the repository's original name # Continue in the case of error, since the previous iteration # worked in the case of the user cloning a repository in the -- cgit v1.2.1