69
69
[http://www.example.com]
71
71
email=Robert Collins <robertc@example.org>
72
normal_option = normal
73
appendpath_option = append
74
norecurse_option = norecurse
75
policy_appendpath = appendpath_option
76
policy_norecurse = norecurse_option
72
77
[http://www.example.com/ignoreparent]
73
78
# different project: ignore parent dir config
74
79
ignore_parents=true
75
80
[http://www.example.com/norecurse]
76
81
# configuration items that only apply to this dir
83
normal_option = norecurse
84
[http://www.example.com/dir]
85
appendpath_option = normal
79
87
check_signatures=require
80
88
# test trailing / matching with no children
600
608
self.assertEqual([('/a/c', ''), ('/a/*', ''), ('/a/', 'c')],
601
609
self.my_location_config._get_matching_sections())
611
def test__get_option_policy_normal(self):
612
self.get_branch_config('http://www.example.com')
614
self.my_location_config._get_config_policy(
615
'http://www.example.com', 'normal_option'),
618
def test__get_option_policy_norecurse(self):
619
self.get_branch_config('http://www.example.com')
621
self.my_location_config._get_option_policy(
622
'http://www.example.com', 'norecurse_option'),
623
config.POLICY_NORECURSE)
624
# Test old recurse=False setting:
626
self.my_location_config._get_option_policy(
627
'http://www.example.com/norecurse', 'normal_option'),
628
config.POLICY_NORECURSE)
630
def test__get_option_policy_normal(self):
631
self.get_branch_config('http://www.example.com')
633
self.my_location_config._get_option_policy(
634
'http://www.example.com', 'appendpath_option'),
635
config.POLICY_APPENDPATH)
603
637
def test_location_without_username(self):
604
638
self.get_branch_config('http://www.example.com/ignoreparent')
605
639
self.assertEqual(u'Erik B\u00e5gfors <erik@bagfors.nu>',
657
691
self.assertEqual('local',
658
692
self.my_config.get_user_option('user_local_option'))
694
def test_get_user_option_appendpath(self):
695
# returned as is for the base path:
696
self.get_branch_config('http://www.example.com')
697
self.assertEqual('append',
698
self.my_config.get_user_option('appendpath_option'))
699
# Extra path components get appended:
700
self.get_branch_config('http://www.example.com/a/b/c')
701
self.assertEqual('append/a/b/c',
702
self.my_config.get_user_option('appendpath_option'))
703
# Overriden for http://www.example.com/dir, where it is a
705
self.get_branch_config('http://www.example.com/dir/a/b/c')
706
self.assertEqual('normal',
707
self.my_config.get_user_option('appendpath_option'))
709
def test_get_user_option_norecurse(self):
710
self.get_branch_config('http://www.example.com')
711
self.assertEqual('norecurse',
712
self.my_config.get_user_option('norecurse_option'))
713
self.get_branch_config('http://www.example.com/dir')
714
self.assertEqual(None,
715
self.my_config.get_user_option('norecurse_option'))
716
# http://www.example.com/norecurse is a recurse=False section
717
# that redefines normal_option. Subdirectories do not pick up
719
self.get_branch_config('http://www.example.com/norecurse')
720
self.assertEqual('norecurse',
721
self.my_config.get_user_option('normal_option'))
722
self.get_branch_config('http://www.example.com/norecurse/subdir')
723
self.assertEqual('normal',
724
self.my_config.get_user_option('normal_option'))
660
726
def test_post_commit_default(self):
661
727
self.get_branch_config('/a/c')
662
728
self.assertEqual('bzrlib.tests.test_config.post_commit',