bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
1 |
# Copyright (C) 2008-2012 Canonical Ltd
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
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.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
17 |
"""Upload a working tree, incrementally.
|
18 |
||
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
19 |
Quickstart
|
20 |
----------
|
|
21 |
||
22 |
To get started, it's as simple as running::
|
|
23 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
24 |
brz upload sftp://user@host/location/on/webserver
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
25 |
|
26 |
This will initially upload the whole working tree, and leave a file on the
|
|
27 |
remote location indicating the last revision that was uploaded
|
|
28 |
(.bzr-upload.revid), in order to avoid uploading unnecessary information the
|
|
29 |
next time.
|
|
30 |
||
31 |
If you would like to upload a specific revision, you just do:
|
|
32 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
33 |
brz upload -r X sftp://user@host/location/on/webserver
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
34 |
|
|
7195.5.1
by Martin
Fix remaining whitespace lint in codebase |
35 |
bzr-upload, just as brz does, will remember the location where you upload the
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
36 |
first time, so you don't need to specify it every time.
|
37 |
||
38 |
If you need to re-upload the whole working tree for some reason, you can:
|
|
39 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
40 |
brz upload --full sftp://user@host/location/on/webserver
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
41 |
|
|
0.159.4
by Gary van der Merwe
Check that the revision we are uploading is a descendent from the revision that was uploaded. |
42 |
This command only works on the revision beening uploaded is a decendent of the
|
43 |
revision that was previously uploaded, and that they are hence from branches
|
|
44 |
that have not diverged. Branches are considered diverged if the destination
|
|
45 |
branch's most recent commit is one that has not been merged (directly or
|
|
46 |
indirectly) by the source branch.
|
|
47 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
48 |
If branches have diverged, you can use 'brz upload --overwrite' to replace
|
|
0.159.4
by Gary van der Merwe
Check that the revision we are uploading is a descendent from the revision that was uploaded. |
49 |
the other branch completely, discarding its unmerged changes.
|
50 |
||
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
51 |
|
52 |
Automatically Uploading
|
|
53 |
-----------------------
|
|
54 |
||
55 |
bzr-upload comes with a hook that can be used to trigger an upload whenever
|
|
56 |
the tip of the branch changes, including on commit, push, uncommit etc. This
|
|
57 |
would allow you to keep the code on the target up to date automatically.
|
|
58 |
||
59 |
The easiest way to enable this is to run upload with the --auto option.
|
|
60 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
61 |
brz upload --auto
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
62 |
|
63 |
will enable the hook for this branch. If you were to do a commit in this branch
|
|
64 |
now you would see it trigger the upload automatically.
|
|
65 |
||
66 |
If you wish to disable this for a branch again then you can use the --no-auto
|
|
67 |
option.
|
|
68 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
69 |
brz upload --no-auto
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
70 |
|
71 |
will disable the feature for that branch.
|
|
72 |
||
73 |
Since the auto hook is triggered automatically, you can't use the --quiet
|
|
74 |
option available for the upload command. Instead, you can set the
|
|
75 |
'upload_auto_quiet' configuration variable to True or False in either
|
|
|
6740.1.1
by Jelmer Vernooij
Rename bazaar.conf to breezy.conf. |
76 |
breezy.conf, locations.conf or branch.conf.
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
77 |
|
78 |
||
79 |
Storing the '.bzr-upload.revid' file
|
|
80 |
------------------------------------
|
|
81 |
||
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
82 |
The only bzr-related info uploaded with the working tree is the corresponding
|
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
83 |
revision id. The uploaded working tree is not linked to any other brz data.
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
84 |
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
85 |
If the layout of your remote server is such that you can't write in the
|
86 |
root directory but only in the directories inside that root, you will need
|
|
87 |
to use the 'upload_revid_location' configuration variable to specify the
|
|
88 |
relative path to be used. That configuration variable can be specified in
|
|
89 |
locations.conf or branch.conf.
|
|
90 |
||
91 |
For example, given the following layout:
|
|
92 |
||
93 |
Project/
|
|
94 |
private/
|
|
95 |
public/
|
|
96 |
||
97 |
you may have write access in 'private' and 'public' but in 'Project'
|
|
98 |
itself. In that case, you can add the following in your locations.conf or
|
|
99 |
branch.conf file:
|
|
100 |
||
101 |
upload_revid_location = private/.bzr-upload.revid
|
|
102 |
||
103 |
||
104 |
Upload from Remote Location
|
|
105 |
---------------------------
|
|
106 |
||
107 |
It is possible to upload to a remote location from another remote location by
|
|
108 |
specifying it with the --directory option:
|
|
109 |
||
|
7195.5.1
by Martin
Fix remaining whitespace lint in codebase |
110 |
brz upload sftp://public.example.com --directory sftp://private.example.com
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
111 |
|
112 |
This, together with --auto, can be used to upload when you push to your
|
|
113 |
central branch, rather than when you commit to your local branch.
|
|
114 |
||
115 |
Note that you will consume more bandwith this way than uploading from a local
|
|
116 |
branch.
|
|
117 |
||
|
0.160.5
by Martin Albisetti
Add docs |
118 |
Ignoring certain files
|
119 |
-----------------------
|
|
120 |
||
121 |
If you want to version a file, but not upload it, you can create a file called
|
|
122 |
.bzrignore-upload, which works in the same way as the regular .bzrignore file,
|
|
123 |
but only applies to bzr-upload.
|
|
124 |
||
125 |
||
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
126 |
Known Issues
|
127 |
------------
|
|
128 |
||
|
0.162.1
by Vincent Ladeuil
Emit warnings instead of crashing when symlinks are encountered |
129 |
* Symlinks are not supported (warnings are emitted when they are encountered).
|
|
0.152.63
by Vincent Ladeuil
Make the doc more easily discoverable. |
130 |
|
131 |
||
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
132 |
"""
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
133 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
134 |
# TODO: the chmod bits *can* be supported via the upload protocols
|
135 |
# (i.e. poorly), but since the web developers use these protocols to upload
|
|
136 |
# manually, it is expected that the associated web server is coherent with
|
|
137 |
# their presence/absence. In other words, if a web hosting provider requires
|
|
138 |
# chmod bits but don't provide an ftp server that support them, well, better
|
|
139 |
# find another provider ;-)
|
|
140 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
141 |
# TODO: The message emitted in verbose mode displays local paths. That may be
|
142 |
# scary for the user when we say 'Deleting <path>' and are referring to
|
|
143 |
# remote files...
|
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
144 |
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
145 |
|
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
146 |
from ... import ( |
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
147 |
commands, |
148 |
config, |
|
|
0.152.95
by Vincent Ladeuil
Cosmetic changes. |
149 |
hooks, |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
150 |
)
|
151 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
152 |
|
|
7143.11.1
by Jelmer Vernooij
Remove some unused imports. |
153 |
from ... import version_info # noqa: F401 |
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
154 |
|
155 |
||
|
0.152.95
by Vincent Ladeuil
Cosmetic changes. |
156 |
def register_option(key, member): |
157 |
"""Lazily register an option.""" |
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
158 |
config.option_registry.register_lazy( |
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
159 |
key, 'breezy.plugins.upload.cmds', member) |
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
160 |
|
161 |
||
|
0.152.95
by Vincent Ladeuil
Cosmetic changes. |
162 |
register_option('upload_auto', 'auto_option') |
163 |
register_option('upload_auto_quiet', 'auto_quiet_option') |
|
164 |
register_option('upload_location', 'location_option') |
|
165 |
register_option('upload_revid_location', 'revid_location_option') |
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
166 |
|
167 |
||
168 |
commands.plugin_cmds.register_lazy( |
|
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
169 |
'cmd_upload', [], 'breezy.plugins.upload.cmds') |
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
170 |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
171 |
|
|
0.152.72
by Vincent Ladeuil
Avoid the recursive loading to be able to BZR_PLUGINS_AT. |
172 |
def auto_upload_hook(params): |
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
173 |
from ... import ( |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
174 |
osutils, |
175 |
trace, |
|
176 |
transport, |
|
177 |
urlutils, |
|
178 |
)
|
|
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
179 |
from .cmds import ( |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
180 |
BzrUploader, |
181 |
)
|
|
182 |
import sys |
|
|
0.152.72
by Vincent Ladeuil
Avoid the recursive loading to be able to BZR_PLUGINS_AT. |
183 |
source_branch = params.branch |
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
184 |
conf = source_branch.get_config_stack() |
185 |
destination = conf.get('upload_location') |
|
|
0.152.72
by Vincent Ladeuil
Avoid the recursive loading to be able to BZR_PLUGINS_AT. |
186 |
if destination is None: |
187 |
return
|
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
188 |
auto_upload = conf.get('upload_auto') |
|
0.152.72
by Vincent Ladeuil
Avoid the recursive loading to be able to BZR_PLUGINS_AT. |
189 |
if not auto_upload: |
190 |
return
|
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
191 |
quiet = conf.get('upload_auto_quiet') |
|
0.152.72
by Vincent Ladeuil
Avoid the recursive loading to be able to BZR_PLUGINS_AT. |
192 |
if not quiet: |
193 |
display_url = urlutils.unescape_for_display( |
|
194 |
destination, osutils.get_terminal_encoding()) |
|
195 |
trace.note('Automatically uploading to %s', display_url) |
|
196 |
to_transport = transport.get_transport(destination) |
|
197 |
last_revision = source_branch.last_revision() |
|
198 |
last_tree = source_branch.repository.revision_tree(last_revision) |
|
199 |
uploader = BzrUploader(source_branch, to_transport, sys.stdout, |
|
200 |
last_tree, last_revision, quiet=quiet) |
|
201 |
uploader.upload_tree() |
|
202 |
||
203 |
||
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
204 |
def install_auto_upload_hook(): |
|
0.152.95
by Vincent Ladeuil
Cosmetic changes. |
205 |
hooks.install_lazy_named_hook( |
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
206 |
'breezy.branch', 'Branch.hooks', |
|
0.170.1
by Jelmer Vernooij
Use install_lazy_named_hook. |
207 |
'post_change_branch_tip', auto_upload_hook, |
208 |
'Auto upload code from a branch when it is changed.') |
|
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
209 |
|
210 |
||
|
0.152.82
by Vincent Ladeuil
``install_named_hook`` is available in bzr >= 2.2, no need to check anymore. Also remove some code left when loading lazily more aggressively. |
211 |
install_auto_upload_hook() |
|
0.155.2
by James Westby
Add a post_change_branch_tip hook to upload. |
212 |
|
213 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
214 |
def load_tests(loader, basic_tests, pattern): |
|
0.153.1
by Vincent Ladeuil
Clean up references to verbose. |
215 |
# This module shouldn't define any tests but I don't know how to report
|
|
0.154.1
by Vincent Ladeuil
Create a simple setup.py and rework tests modules accordingly. |
216 |
# that. I prefer to update basic_tests with the other tests to detect
|
217 |
# unwanted tests and I think that's sufficient.
|
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
218 |
|
219 |
testmod_names = [ |
|
|
0.154.1
by Vincent Ladeuil
Create a simple setup.py and rework tests modules accordingly. |
220 |
'tests', |
|
0.152.1
by Vincent Ladeuil
Empty shell |
221 |
]
|
|
0.154.1
by Vincent Ladeuil
Create a simple setup.py and rework tests modules accordingly. |
222 |
basic_tests.addTest(loader.loadTestsFromModuleNames( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
223 |
["%s.%s" % (__name__, tmn) for tmn in testmod_names])) |
|
0.154.1
by Vincent Ladeuil
Create a simple setup.py and rework tests modules accordingly. |
224 |
return basic_tests |