bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
1 |
# Copyright (C) 2008, 2009 Canonical Ltd
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
import os |
|
18 |
||
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
19 |
from bzrlib import ( |
20 |
branch, |
|
21 |
tests, |
|
22 |
)
|
|
23 |
||
24 |
from bzrlib.plugins import upload |
|
25 |
||
26 |
||
27 |
class AutoPushHookTests(tests.TestCaseWithTransport): |
|
28 |
||
29 |
def setUp(self): |
|
30 |
super(AutoPushHookTests, self).setUp() |
|
31 |
upload.install_auto_upload_hook() |
|
32 |
||
33 |
def make_start_branch(self): |
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
34 |
self.wt = self.make_branch_and_tree('.') |
35 |
self.build_tree(['a']) |
|
36 |
self.wt.add(['a']) |
|
37 |
self.wt.commit("one") |
|
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
38 |
|
39 |
||
40 |
class AutoPushWithLocation(AutoPushHookTests): |
|
41 |
||
42 |
def setUp(self): |
|
43 |
super(AutoPushWithLocation, self).setUp() |
|
44 |
self.make_start_branch() |
|
45 |
upload.set_upload_auto(self.wt.branch, True) |
|
46 |
upload.set_upload_location(self.wt.branch, self.get_url('target')) |
|
47 |
upload.set_upload_auto_quiet(self.wt.branch, 'True') |
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
48 |
|
49 |
def test_auto_push_on_commit(self): |
|
50 |
self.failIfExists('target') |
|
51 |
self.build_tree(['b']) |
|
52 |
self.wt.add(['b']) |
|
53 |
self.wt.commit("two") |
|
54 |
self.failUnlessExists('target') |
|
55 |
self.failUnlessExists(os.path.join('target', 'a')) |
|
56 |
self.failUnlessExists(os.path.join('target', 'b')) |
|
57 |
||
58 |
def test_disable_auto_push(self): |
|
59 |
self.failIfExists('target') |
|
60 |
self.build_tree(['b']) |
|
61 |
self.wt.add(['b']) |
|
62 |
self.wt.commit("two") |
|
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
63 |
upload.set_upload_auto(self.wt.branch, False) |
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
64 |
self.build_tree(['c']) |
65 |
self.wt.add(['c']) |
|
66 |
self.wt.commit("three") |
|
67 |
self.failIfExists(os.path.join('target', 'c')) |
|
68 |
||
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
69 |
|
70 |
class AutoPushWithoutLocation(AutoPushHookTests): |
|
71 |
||
72 |
def setUp(self): |
|
73 |
super(AutoPushWithoutLocation, self).setUp() |
|
74 |
self.make_start_branch() |
|
75 |
upload.set_upload_auto(self.wt.branch, True) |
|
76 |
||
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
77 |
def test_dont_push_if_no_location(self): |
78 |
self.failIfExists('target') |
|
79 |
self.build_tree(['b']) |
|
80 |
self.wt.add(['b']) |
|
81 |
self.wt.commit("two") |
|
82 |
self.failIfExists('target') |