Bug#502779: Sync accounts in order of general.accounts option

On Tue, Apr 21, 11:19:00 -0500, John Goerzen wrote:
> I think the one loss of functionality we have here is that it doesn't
> check if a given account has already been listed before adding to the
> list.  Should be a simple tweak.  If you could tweak that and test, I'd
> apply a new patch.

Good catch. I attach an updated patch which I've tested and it appears
to work fine, including not syncing two accounts twice.

Thanks,

--
Jonny Lamb, UK
jonny@debian.org

From 7f348ee116bba64f7330e28d4e7b2c015910a890 Mon Sep 17 00:00:00 2001
From: Jonny Lamb <jonny@debian.org>
Date: Tue, 05 May 2009 20:45:17 +0100
Subject: [PATCH] Respect order of general.accounts config setting.

This makes the order of account synchronisation the same as the order of
the general.accounts setting by using a list instead of a dict, which
was actually pointless as the value of each dict item was never even
looked at.

Signed-off-by: Jonny Lamb <jonny@debian.org>
This commit is contained in:
Jonny Lamb 2009-05-05 20:47:11 +01:00 committed by John Goerzen
parent 817c09a460
commit 2e22b41231

View File

@ -158,7 +158,7 @@ def startup(versionno):
activeaccounts = activeaccounts.split(",")
allaccounts = accounts.AccountHashGenerator(config)
syncaccounts = {}
syncaccounts = []
for account in activeaccounts:
if account not in allaccounts:
if len(allaccounts) == 0:
@ -168,7 +168,8 @@ def startup(versionno):
for name in allaccounts.keys():
errormsg += '\n%s'%name
ui.terminate(1, errortitle = 'Unknown Account "%s"'%account, errormsg = errormsg)
syncaccounts[account] = allaccounts[account]
if account not in syncaccounts:
syncaccounts.append(account)
server = None
remoterepos = None