isync/mbsync: replace master/slave with far/near (#1776)
* isync/mbsync: replace master/slave with far/near isync/mbsync: update tests to match new changes * isync/mbsync: use mkRenamedOptionModule to alert user to near/far change * isync/mbsync: use warnings to alert about master/slave far/near change Fix capitalization isync/mbsync: fix nitpicks * isync/mbsync: run format script * isync/mbsync: include new test for expected master/slave warnings * isync/mbsync: add news about changes
This commit is contained in:
parent
4f70f49cec
commit
64607f58b7
6 changed files with 239 additions and 87 deletions
|
|
@ -16,30 +16,30 @@ Path /home/hm-user/Mail/hm-account/
|
|||
SubFolders Verbatim
|
||||
|
||||
Channel emptyChannels-empty1
|
||||
Master :hm-account-remote:
|
||||
Slave :hm-account-local:
|
||||
Far :hm-account-remote:
|
||||
Near :hm-account-local:
|
||||
|
||||
Channel emptyChannels-empty2
|
||||
Master :hm-account-remote:
|
||||
Slave :hm-account-local:
|
||||
Far :hm-account-remote:
|
||||
Near :hm-account-local:
|
||||
|
||||
Channel hm-account-earlierPatternMatch
|
||||
Master :hm-account-remote:Label
|
||||
Slave :hm-account-local:SomethingUnderLabel
|
||||
Far :hm-account-remote:Label
|
||||
Near :hm-account-local:SomethingUnderLabel
|
||||
Pattern ThingUnderLabel !NotThisMaildirThough "[Weird] Label?"
|
||||
|
||||
Channel hm-account-inbox
|
||||
Master :hm-account-remote:Inbox
|
||||
Slave :hm-account-local:Inbox
|
||||
Far :hm-account-remote:Inbox
|
||||
Near :hm-account-local:Inbox
|
||||
|
||||
Channel hm-account-patternMatch
|
||||
Master :hm-account-remote:Label
|
||||
Slave :hm-account-local:SomethingUnderLabel
|
||||
Far :hm-account-remote:Label
|
||||
Near :hm-account-local:SomethingUnderLabel
|
||||
Pattern ThingUnderLabel !NotThisMaildirThough "[Weird] Label?"
|
||||
|
||||
Channel hm-account-strangeHostBoxName
|
||||
Master ":hm-account-remote:[Weird]/Label Mess"
|
||||
Slave :hm-account-local:[AnotherWeird]/Label
|
||||
Far ":hm-account-remote:[Weird]/Label Mess"
|
||||
Near :hm-account-local:[AnotherWeird]/Label
|
||||
|
||||
Group emptyChannels
|
||||
Channel emptyChannels-empty1
|
||||
|
|
@ -68,12 +68,12 @@ Path /home/hm-user/Mail/hm@example.com/
|
|||
SubFolders Verbatim
|
||||
|
||||
Channel inboxes-inbox1
|
||||
Master :hm@example.com-remote:Inbox1
|
||||
Slave :hm@example.com-local:Inboxes
|
||||
Far :hm@example.com-remote:Inbox1
|
||||
Near :hm@example.com-local:Inboxes
|
||||
|
||||
Channel inboxes-inbox2
|
||||
Master :hm@example.com-remote:Inbox2
|
||||
Slave :hm@example.com-local:Inboxes
|
||||
Far :hm@example.com-remote:Inbox2
|
||||
Near :hm@example.com-local:Inboxes
|
||||
|
||||
Group inboxes
|
||||
Channel inboxes-inbox1
|
||||
|
|
|
|||
93
tests/modules/programs/mbsync/mbsync-master-slave-change.nix
Normal file
93
tests/modules/programs/mbsync/mbsync-master-slave-change.nix
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports = [ ../../accounts/email-test-accounts.nix ];
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"mbsync channels no longer use masterPattern. Use farPattern in its place."
|
||||
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
|
||||
];
|
||||
|
||||
config = {
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
# programs.mbsync.groups and
|
||||
# accounts.email.accounts.<name>.mbsync.groups should NOT be used at the
|
||||
# same time.
|
||||
# If they are, then the new version will take precendence.
|
||||
groups.inboxes = {
|
||||
"hm@example.com" = [ "Inbox1" "Inbox2" ];
|
||||
hm-account = [ "Inbox" ];
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = {
|
||||
"hm@example.com".mbsync = {
|
||||
enable = true;
|
||||
groups.inboxes = {
|
||||
channels = {
|
||||
inbox1 = {
|
||||
farPattern = "Inbox1";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
inbox2 = {
|
||||
farPattern = "Inbox2";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hm-account.mbsync = {
|
||||
enable = true;
|
||||
groups.hm-account = {
|
||||
channels.earlierPatternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
''"[Weird] Label?"''
|
||||
];
|
||||
};
|
||||
channels.inbox = {
|
||||
farPattern = "Inbox";
|
||||
nearPattern = "Inbox";
|
||||
};
|
||||
channels.strangeHostBoxName = {
|
||||
farPattern = "[Weird]/Label Mess";
|
||||
nearPattern = "[AnotherWeird]/Label";
|
||||
};
|
||||
channels.patternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
''"[Weird] Label?"''
|
||||
];
|
||||
};
|
||||
};
|
||||
# No group should be printed.
|
||||
groups.emptyGroup = { };
|
||||
# Group should be printed, but left with default channels.
|
||||
groups.emptyChannels = {
|
||||
channels.empty1 = { };
|
||||
channels.empty2 = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"mbsync channels no longer use masterPattern. use farPattern in its place."
|
||||
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.mbsyncrc
|
||||
assertFileContent home-files/.mbsyncrc ${./mbsync-expected.conf}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -24,12 +24,12 @@ with lib;
|
|||
groups.inboxes = {
|
||||
channels = {
|
||||
inbox1 = {
|
||||
masterPattern = "Inbox1";
|
||||
slavePattern = "Inboxes";
|
||||
farPattern = "Inbox1";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
inbox2 = {
|
||||
masterPattern = "Inbox2";
|
||||
slavePattern = "Inboxes";
|
||||
farPattern = "Inbox2";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -39,8 +39,8 @@ with lib;
|
|||
enable = true;
|
||||
groups.hm-account = {
|
||||
channels.earlierPatternMatch = {
|
||||
masterPattern = "Label";
|
||||
slavePattern = "SomethingUnderLabel";
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
|
|
@ -48,16 +48,16 @@ with lib;
|
|||
];
|
||||
};
|
||||
channels.inbox = {
|
||||
masterPattern = "Inbox";
|
||||
slavePattern = "Inbox";
|
||||
farPattern = "Inbox";
|
||||
nearPattern = "Inbox";
|
||||
};
|
||||
channels.strangeHostBoxName = {
|
||||
masterPattern = "[Weird]/Label Mess";
|
||||
slavePattern = "[AnotherWeird]/Label";
|
||||
farPattern = "[Weird]/Label Mess";
|
||||
nearPattern = "[AnotherWeird]/Label";
|
||||
};
|
||||
channels.patternMatch = {
|
||||
masterPattern = "Label";
|
||||
slavePattern = "SomethingUnderLabel";
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue