bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.152.1
by Vincent Ladeuil
Empty shell |
1 |
# Copyright (C) 2007 Canonical Ltd
|
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 |
||
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
17 |
"""Upload a working tree, incrementally"""
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
18 |
|
|
0.152.3
by v.ladeuil+lp at free
Make the tests fail not error out. |
19 |
from bzrlib import ( |
20 |
commands, |
|
21 |
option, |
|
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
22 |
transport, |
23 |
workingtree, |
|
|
0.152.3
by v.ladeuil+lp at free
Make the tests fail not error out. |
24 |
)
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
25 |
|
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
26 |
def upload_full_tree(tree, tdest): |
27 |
tdest.ensure_base() # XXX: Handle errors |
|
28 |
tree.lock_read() |
|
29 |
try: |
|
30 |
inv = tree.inventory |
|
31 |
entries = inv.iter_entries() |
|
32 |
entries.next() # skip root |
|
33 |
for dp, ie in entries: |
|
34 |
# .bzrignore has no meaning outside of a working tree
|
|
35 |
# so do not export it
|
|
36 |
if dp == ".bzrignore": |
|
37 |
continue
|
|
38 |
||
39 |
import pdb; pdb.set_trace() |
|
40 |
ie.put_on_disk(tdest.local_abspath('.'), dp, tree) |
|
41 |
finally: |
|
42 |
tree.unlock() |
|
43 |
||
44 |
||
|
0.152.1
by Vincent Ladeuil
Empty shell |
45 |
class cmd_upload(commands.Command): |
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
46 |
"""Upload a working tree, as a whole or incrementally. |
47 |
||
48 |
If no destination is specified use the last one used.
|
|
49 |
If no revision is specified upload the changes since the last upload.
|
|
50 |
"""
|
|
51 |
takes_args = ['dest?'] |
|
52 |
takes_options = [ |
|
53 |
'revision', |
|
|
0.152.3
by v.ladeuil+lp at free
Make the tests fail not error out. |
54 |
option.Option('full', 'Upload the full working tree.'), |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
55 |
]
|
|
0.152.3
by v.ladeuil+lp at free
Make the tests fail not error out. |
56 |
def run(self, dest, full=False, revision=None): |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
57 |
tree = workingtree.WorkingTree.open_containing(u'.')[0] |
58 |
b = tree.branch |
|
59 |
||
60 |
if dest is None: |
|
61 |
raise NotImplementedError |
|
62 |
else: |
|
63 |
tdest = transport.get_transport(dest) |
|
64 |
if revision is None: |
|
65 |
rev_id = tree.last_revision() |
|
66 |
else: |
|
67 |
if len(revision) != 1: |
|
68 |
raise errors.BzrCommandError( |
|
69 |
'bzr upload --revision takes exactly 1 argument') |
|
70 |
rev_id = revision[0].in_history(b).rev_id |
|
71 |
||
72 |
tree_to_upload = b.repository.revision_tree(rev_id) |
|
73 |
if full: |
|
74 |
upload_full_tree(tree_to_upload, tdest) |
|
75 |
else: |
|
76 |
raise NotImplementedError |
|
77 |
||
|
0.152.1
by Vincent Ladeuil
Empty shell |
78 |
|
79 |
commands.register_command(cmd_upload) |
|
80 |
||
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
81 |
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
82 |
def test_suite(): |
83 |
from bzrlib.tests import TestUtil |
|
84 |
||
85 |
suite = TestUtil.TestSuite() |
|
86 |
loader = TestUtil.TestLoader() |
|
87 |
testmod_names = [ |
|
88 |
'test_upload', |
|
89 |
]
|
|
90 |
||
91 |
suite.addTest(loader.loadTestsFromModuleNames( |
|
92 |
["%s.%s" % (__name__, tmn) for tmn in testmod_names])) |
|
93 |
return suite |