Merge lp:~jelmer/ubuntu/natty/bzr/sru-2.3.4 into lp:ubuntu/natty/bzr
- Natty (11.04)
- sru-2.3.4
- Merge into natty
Status: | Merged |
---|---|
Merge reported by: | Jelmer Vernooij |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/ubuntu/natty/bzr/sru-2.3.4 |
Merge into: | lp:ubuntu/natty/bzr |
Diff against target: |
7694 lines (+3062/-823) 130 files modified
Makefile (+1/-1) bzr (+2/-2) bzrlib/__init__.py (+2/-2) bzrlib/branch.py (+24/-10) bzrlib/builtins.py (+2/-2) bzrlib/commands.py (+7/-6) bzrlib/config.py (+86/-5) bzrlib/controldir.py (+4/-0) bzrlib/crash.py (+18/-10) bzrlib/help_topics/en/configuration.txt (+3/-1) bzrlib/inventory.py (+69/-2) bzrlib/lockdir.py (+12/-7) bzrlib/merge.py (+8/-2) bzrlib/osutils.py (+12/-0) bzrlib/plugin.py (+12/-1) bzrlib/plugins/launchpad/test_register.py (+6/-3) bzrlib/tests/__init__.py (+13/-5) bzrlib/tests/blackbox/test_bound_branches.py (+1/-1) bzrlib/tests/blackbox/test_branch.py (+5/-5) bzrlib/tests/blackbox/test_checkout.py (+4/-4) bzrlib/tests/blackbox/test_clean_tree.py (+19/-19) bzrlib/tests/blackbox/test_commit.py (+4/-0) bzrlib/tests/blackbox/test_export.py (+18/-18) bzrlib/tests/blackbox/test_init.py (+2/-2) bzrlib/tests/blackbox/test_merge.py (+40/-22) bzrlib/tests/blackbox/test_mv.py (+27/-27) bzrlib/tests/blackbox/test_non_ascii.py (+7/-7) bzrlib/tests/blackbox/test_push.py (+21/-5) bzrlib/tests/blackbox/test_reconfigure.py (+1/-1) bzrlib/tests/blackbox/test_remerge.py (+4/-4) bzrlib/tests/blackbox/test_remove.py (+10/-10) bzrlib/tests/blackbox/test_remove_tree.py (+32/-32) bzrlib/tests/blackbox/test_revert.py (+9/-9) bzrlib/tests/blackbox/test_rmbranch.py (+2/-2) bzrlib/tests/blackbox/test_shared_repository.py (+1/-1) bzrlib/tests/blackbox/test_shelve.py (+1/-1) bzrlib/tests/blackbox/test_switch.py (+6/-6) bzrlib/tests/blackbox/test_too_much.py (+10/-10) bzrlib/tests/blackbox/test_update.py (+6/-6) bzrlib/tests/blackbox/test_version.py (+5/-5) bzrlib/tests/blackbox/test_versioning.py (+9/-9) bzrlib/tests/blackbox/test_whoami.py (+4/-1) bzrlib/tests/doc_generate/builders/test_texinfo.py (+2/-2) bzrlib/tests/features.py (+15/-0) bzrlib/tests/per_branch/test_bound_sftp.py (+8/-8) bzrlib/tests/per_branch/test_branch.py (+66/-6) bzrlib/tests/per_branch/test_create_checkout.py (+2/-2) bzrlib/tests/per_branch/test_push.py (+53/-1) bzrlib/tests/per_branch/test_sprout.py (+1/-1) bzrlib/tests/per_bzrdir/test_bzrdir.py (+4/-4) bzrlib/tests/per_controldir/test_controldir.py (+17/-17) bzrlib/tests/per_controldir_colo/test_supported.py (+1/-1) bzrlib/tests/per_repository/test_commit_builder.py (+5/-0) bzrlib/tests/per_repository/test_has_same_location.py (+1/-1) bzrlib/tests/per_repository/test_repository.py (+2/-2) bzrlib/tests/per_transport.py (+40/-40) bzrlib/tests/per_tree/test_get_file_mtime.py (+1/-1) bzrlib/tests/per_workingtree/test_commit.py (+1/-1) bzrlib/tests/per_workingtree/test_executable.py (+6/-6) bzrlib/tests/per_workingtree/test_move.py (+3/-3) bzrlib/tests/per_workingtree/test_pull.py (+4/-4) bzrlib/tests/per_workingtree/test_remove.py (+28/-28) bzrlib/tests/per_workingtree/test_rename_one.py (+4/-4) bzrlib/tests/per_workingtree/test_workingtree.py (+13/-13) bzrlib/tests/test_atomicfile.py (+1/-1) bzrlib/tests/test_branch.py (+10/-10) bzrlib/tests/test_bundle.py (+1/-1) bzrlib/tests/test_bzrdir.py (+6/-7) bzrlib/tests/test_cache_utf8.py (+15/-15) bzrlib/tests/test_clean_tree.py (+3/-3) bzrlib/tests/test_commit.py (+3/-3) bzrlib/tests/test_config.py (+29/-6) bzrlib/tests/test_conflicts.py (+91/-25) bzrlib/tests/test_crash.py (+46/-3) bzrlib/tests/test_diff.py (+1/-1) bzrlib/tests/test_export.py (+9/-9) bzrlib/tests/test_ftp_transport.py (+2/-2) bzrlib/tests/test_generate_ids.py (+2/-2) bzrlib/tests/test_globbing.py (+2/-2) bzrlib/tests/test_ignores.py (+2/-2) bzrlib/tests/test_inv.py (+85/-3) bzrlib/tests/test_lazy_import.py (+2/-2) bzrlib/tests/test_lazy_regex.py (+1/-1) bzrlib/tests/test_lockdir.py (+5/-5) bzrlib/tests/test_lru_cache.py (+7/-7) bzrlib/tests/test_merge.py (+4/-4) bzrlib/tests/test_merge_core.py (+14/-14) bzrlib/tests/test_multiparent.py (+5/-5) bzrlib/tests/test_osutils.py (+31/-22) bzrlib/tests/test_plugins.py (+14/-14) bzrlib/tests/test_registry.py (+6/-6) bzrlib/tests/test_remote.py (+20/-0) bzrlib/tests/test_repository.py (+1/-1) bzrlib/tests/test_revert.py (+15/-15) bzrlib/tests/test_revisionspec.py (+1/-1) bzrlib/tests/test_script.py (+21/-21) bzrlib/tests/test_selftest.py (+23/-17) bzrlib/tests/test_sftp_transport.py (+8/-8) bzrlib/tests/test_shelf.py (+9/-9) bzrlib/tests/test_shelf_ui.py (+2/-2) bzrlib/tests/test_smart_add.py (+3/-3) bzrlib/tests/test_store.py (+6/-6) bzrlib/tests/test_subsume.py (+2/-2) bzrlib/tests/test_switch.py (+16/-16) bzrlib/tests/test_transform.py (+60/-60) bzrlib/tests/test_transport.py (+3/-3) bzrlib/tests/test_treeshape.py (+2/-2) bzrlib/tests/test_tuned_gzip.py (+1/-1) bzrlib/tests/test_uncommit.py (+1/-1) bzrlib/tests/test_upgrade.py (+17/-18) bzrlib/tests/test_version.py (+1/-1) bzrlib/tests/test_version_info.py (+3/-3) bzrlib/tests/test_workingtree.py (+3/-3) debian/changelog (+31/-0) debian/patches/02_external_configobj (+18/-13) debian/patches/07_lazy_import_scope (+1291/-0) debian/patches/08_fix_auto_user_id_test (+19/-0) debian/patches/series (+2/-0) debian/watch (+1/-1) doc/developers/testing.txt (+5/-0) doc/en/release-notes/bzr-2.1.txt (+38/-1) doc/en/release-notes/bzr-2.2.txt (+3/-0) doc/en/release-notes/bzr-2.3.txt (+174/-0) doc/en/user-guide/stacked.txt (+33/-24) doc/en/whats-new/whats-new-in-2.3.txt (+7/-0) doc/ja/index.txt (+1/-1) doc/ja/upgrade-guide/data_migration.txt (+2/-2) doc/ja/user-guide/stacked.txt (+1/-1) setup.py (+9/-0) tools/win32/py2exe_boot_common.py (+6/-1) |
To merge this branch: | bzr merge lp:~jelmer/ubuntu/natty/bzr/sru-2.3.4 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pool (community) | Approve | ||
Ubuntu Stable Release Updates Team | Pending | ||
Review via email: mp+68020@code.launchpad.net |
Commit message
Description of the change
bzr (2.3.4-0ubuntu1) natty-proposed; urgency=low
* New upstream release.
+ Fix bzr version number in deprecation warnings. LP: #794960
+ Prevent write attemps on remote branch during "bzr up". LP: #786980
+ Fix conflict handling when two trees involved in a merge have different
root ids. LP: #805809
-- Jelmer Vernooij <email address hidden> Thu, 14 Jul 2011 21:12:58 +0200
bzr (2.3.3-0ubuntu1) natty-proposed; urgency=low
* New upstream release.
+ Fixes deprecation warning on newer versions of Python. LP: #760435
+ Stops 'bzr push' from copying entire repository if a .bzr directory is
present without a branch. LP: #465517
+ Fixes undefined local variable error when waiting for lock. LP: #733136
+ Fixes lock contention issues pushing to a bound branch. LP: #733350
+ Transfers less data creating a new stacked branch. LP: #737234
+ Several fixes to the test suite, making it more robust. LP: #654733,
LP: #751824
+ 'bzr merge --pull --preview' actually shows a preview rather than
actually merging. LP: #760152
+ bzr smart server now supports UTF-8 user names. LP: #659763
+ user identity can now be set based on username and /etc/mailname, not
requiring it to be set manually. LP: #616878
+ stacking is now fully transitive. LP: #715000
+ makes in-terminal crash report of plugins much shorter. LP: #716389
-- Jelmer Vernooij <email address hidden> Wed, 08 Jun 2011 13:58:00 +0100
Martin Pool (mbp) wrote : | # |
The package based on this is now uploaded and waiting in https:/
Preview Diff
1 | === modified file 'Makefile' |
2 | --- Makefile 2010-11-05 23:21:04 +0000 |
3 | +++ Makefile 2011-07-14 21:01:48 +0000 |
4 | @@ -42,7 +42,7 @@ |
5 | set -e |
6 | # Generate a stream for PQM to watch. |
7 | -$(RM) -f selftest.log |
8 | - $(PYTHON) -Werror -O ./bzr selftest --subunit $(tests) | tee selftest.log |
9 | + $(PYTHON) -Werror -Wignore::ImportWarning -O ./bzr selftest --subunit $(tests) | tee selftest.log |
10 | # An empty log file should catch errors in the $(PYTHON) |
11 | # command above (the '|' swallow any errors since 'make' |
12 | # sees the 'tee' exit code for the whole line |
13 | |
14 | === modified file 'bzr' |
15 | --- bzr 2011-03-13 15:08:21 +0000 |
16 | +++ bzr 2011-07-14 21:01:48 +0000 |
17 | @@ -1,6 +1,6 @@ |
18 | #! /usr/bin/env python |
19 | |
20 | -# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd |
21 | +# Copyright (C) 2005-2011 Canonical Ltd |
22 | # |
23 | # This program is free software; you can redistribute it and/or modify |
24 | # it under the terms of the GNU General Public License as published by |
25 | @@ -23,7 +23,7 @@ |
26 | import warnings |
27 | |
28 | # update this on each release |
29 | -_script_version = (2, 3, 1) |
30 | +_script_version = (2, 3, 4) |
31 | |
32 | try: |
33 | version_info = sys.version_info |
34 | |
35 | === modified file 'bzrlib/__init__.py' |
36 | --- bzrlib/__init__.py 2011-03-13 15:08:21 +0000 |
37 | +++ bzrlib/__init__.py 2011-07-14 21:01:48 +0000 |
38 | @@ -43,7 +43,7 @@ |
39 | IGNORE_FILENAME = ".bzrignore" |
40 | |
41 | |
42 | -__copyright__ = "Copyright 2005-2010 Canonical Ltd." |
43 | +__copyright__ = "Copyright 2005-2011 Canonical Ltd." |
44 | |
45 | # same format as sys.version_info: "A tuple containing the five components of |
46 | # the version number: major, minor, micro, releaselevel, and serial. All |
47 | @@ -52,7 +52,7 @@ |
48 | # Python version 2.0 is (2, 0, 0, 'final', 0)." Additionally we use a |
49 | # releaselevel of 'dev' for unreleased under-development code. |
50 | |
51 | -version_info = (2, 3, 1, 'final', 0) |
52 | +version_info = (2, 3, 4, 'final', 0) |
53 | |
54 | # API compatibility version |
55 | api_minimum_version = (2, 3, 0) |
56 | |
57 | === modified file 'bzrlib/branch.py' |
58 | --- bzrlib/branch.py 2011-01-21 22:08:19 +0000 |
59 | +++ bzrlib/branch.py 2011-07-14 21:01:48 +0000 |
60 | @@ -71,8 +71,9 @@ |
61 | :ivar base: |
62 | Base directory/url of the branch; using control_url and |
63 | control_transport is more standardized. |
64 | - |
65 | - hooks: An instance of BranchHooks. |
66 | + :ivar hooks: An instance of BranchHooks. |
67 | + :ivar _master_branch_cache: cached result of get_master_branch, see |
68 | + _clear_cached_state. |
69 | """ |
70 | # this is really an instance variable - FIXME move it there |
71 | # - RBC 20060112 |
72 | @@ -94,6 +95,7 @@ |
73 | self._partial_revision_history_cache = [] |
74 | self._tags_bytes = None |
75 | self._last_revision_info_cache = None |
76 | + self._master_branch_cache = None |
77 | self._merge_sorted_revisions_cache = None |
78 | self._open_hook() |
79 | hooks = Branch.hooks['open'] |
80 | @@ -926,6 +928,7 @@ |
81 | self._revision_history_cache = None |
82 | self._revision_id_to_revno_cache = None |
83 | self._last_revision_info_cache = None |
84 | + self._master_branch_cache = None |
85 | self._merge_sorted_revisions_cache = None |
86 | self._partial_revision_history_cache = [] |
87 | self._partial_revision_id_to_revno_cache = {} |
88 | @@ -2671,8 +2674,7 @@ |
89 | target.update_revisions(self, stop_revision, |
90 | overwrite=overwrite, graph=graph) |
91 | if self._push_should_merge_tags(): |
92 | - result.tag_conflicts = self.tags.merge_to(target.tags, |
93 | - overwrite) |
94 | + result.tag_conflicts = self.tags.merge_to(target.tags, overwrite) |
95 | result.new_revno, result.new_revid = target.last_revision_info() |
96 | return result |
97 | |
98 | @@ -2723,12 +2725,13 @@ |
99 | """Return the branch we are bound to. |
100 | |
101 | :return: Either a Branch, or None |
102 | - |
103 | - This could memoise the branch, but if thats done |
104 | - it must be revalidated on each new lock. |
105 | - So for now we just don't memoise it. |
106 | - # RBC 20060304 review this decision. |
107 | """ |
108 | + if self._master_branch_cache is None: |
109 | + self._master_branch_cache = self._get_master_branch( |
110 | + possible_transports) |
111 | + return self._master_branch_cache |
112 | + |
113 | + def _get_master_branch(self, possible_transports): |
114 | bound_loc = self.get_bound_location() |
115 | if not bound_loc: |
116 | return None |
117 | @@ -2745,6 +2748,7 @@ |
118 | |
119 | :param location: URL to the target branch |
120 | """ |
121 | + self._master_branch_cache = None |
122 | if location: |
123 | self._transport.put_bytes('bound', location+'\n', |
124 | mode=self.bzrdir._get_file_mode()) |
125 | @@ -3002,6 +3006,7 @@ |
126 | |
127 | def set_bound_location(self, location): |
128 | """See Branch.set_push_location.""" |
129 | + self._master_branch_cache = None |
130 | result = None |
131 | config = self.get_config() |
132 | if location is None: |
133 | @@ -3461,7 +3466,16 @@ |
134 | if local and not bound_location: |
135 | raise errors.LocalRequiresBoundBranch() |
136 | master_branch = None |
137 | - source_is_master = (self.source.user_url == bound_location) |
138 | + source_is_master = False |
139 | + if bound_location: |
140 | + # bound_location comes from a config file, some care has to be |
141 | + # taken to relate it to source.user_url |
142 | + normalized = urlutils.normalize_url(bound_location) |
143 | + try: |
144 | + relpath = self.source.user_transport.relpath(normalized) |
145 | + source_is_master = (relpath == '') |
146 | + except (errors.PathNotChild, errors.InvalidURL): |
147 | + source_is_master = False |
148 | if not local and bound_location and not source_is_master: |
149 | # not pulling from master, so we need to update master. |
150 | master_branch = self.target.get_master_branch(possible_transports) |
151 | |
152 | === modified file 'bzrlib/builtins.py' |
153 | --- bzrlib/builtins.py 2011-01-21 22:08:19 +0000 |
154 | +++ bzrlib/builtins.py 2011-07-14 21:01:48 +0000 |
155 | @@ -2726,7 +2726,7 @@ |
156 | bzr ignore "RE:(?!debian/).*" |
157 | |
158 | Ignore everything except the "local" toplevel directory, |
159 | - but always ignore "*~" autosave files, even under local/:: |
160 | + but always ignore ``*~`` autosave files, even under local/:: |
161 | |
162 | bzr ignore "*" |
163 | bzr ignore "!./local" |
164 | @@ -3948,7 +3948,7 @@ |
165 | merger.other_rev_id is not None): |
166 | note('Nothing to do.') |
167 | return 0 |
168 | - if pull: |
169 | + if pull and not preview: |
170 | if merger.interesting_files is not None: |
171 | raise errors.BzrCommandError('Cannot pull individual files') |
172 | if (merger.base_rev_id == tree.last_revision()): |
173 | |
174 | === modified file 'bzrlib/commands.py' |
175 | --- bzrlib/commands.py 2011-03-13 15:08:21 +0000 |
176 | +++ bzrlib/commands.py 2011-07-14 21:01:48 +0000 |
177 | @@ -514,12 +514,13 @@ |
178 | # so we get <https://bugs.launchpad.net/bzr/+bug/249908>. -- mbp |
179 | # 20090319 |
180 | options = option.get_optparser(self.options()).format_option_help() |
181 | - # XXX: According to the spec, ReST option lists actually don't support |
182 | - # options like --1.9 so that causes syntax errors (in Sphinx at least). |
183 | - # As that pattern always appears in the commands that break, we trap |
184 | - # on that and then format that block of 'format' options as a literal |
185 | - # block. |
186 | - if not plain and options.find(' --1.9 ') != -1: |
187 | + # FIXME: According to the spec, ReST option lists actually don't |
188 | + # support options like --1.14 so that causes syntax errors (in Sphinx |
189 | + # at least). As that pattern always appears in the commands that |
190 | + # break, we trap on that and then format that block of 'format' options |
191 | + # as a literal block. We use the most recent format still listed so we |
192 | + # don't have to do that too often -- vila 20110514 |
193 | + if not plain and options.find(' --1.14 ') != -1: |
194 | options = options.replace(' format:\n', ' format::\n\n', 1) |
195 | if options.startswith('Options:'): |
196 | result += ':' + options |
197 | |
198 | === modified file 'bzrlib/config.py' |
199 | --- bzrlib/config.py 2011-01-21 22:08:19 +0000 |
200 | +++ bzrlib/config.py 2011-07-14 21:01:48 +0000 |
201 | @@ -63,6 +63,7 @@ |
202 | """ |
203 | |
204 | import os |
205 | +import string |
206 | import sys |
207 | |
208 | from bzrlib import commands |
209 | @@ -271,21 +272,21 @@ |
210 | the concrete policy type is checked, and finally |
211 | $EMAIL is examined. |
212 | If no username can be found, errors.NoWhoami exception is raised. |
213 | - |
214 | - TODO: Check it's reasonably well-formed. |
215 | """ |
216 | v = os.environ.get('BZR_EMAIL') |
217 | if v: |
218 | return v.decode(osutils.get_user_encoding()) |
219 | - |
220 | v = self._get_user_id() |
221 | if v: |
222 | return v |
223 | - |
224 | v = os.environ.get('EMAIL') |
225 | if v: |
226 | return v.decode(osutils.get_user_encoding()) |
227 | - |
228 | + name, email = _auto_user_id() |
229 | + if name and email: |
230 | + return '%s <%s>' % (name, email) |
231 | + elif email: |
232 | + return email |
233 | raise errors.NoWhoami() |
234 | |
235 | def ensure_username(self): |
236 | @@ -1213,6 +1214,86 @@ |
237 | return os.path.expanduser('~/.cache') |
238 | |
239 | |
240 | +def _get_default_mail_domain(): |
241 | + """If possible, return the assumed default email domain. |
242 | + |
243 | + :returns: string mail domain, or None. |
244 | + """ |
245 | + if sys.platform == 'win32': |
246 | + # No implementation yet; patches welcome |
247 | + return None |
248 | + try: |
249 | + f = open('/etc/mailname') |
250 | + except (IOError, OSError), e: |
251 | + return None |
252 | + try: |
253 | + domain = f.read().strip() |
254 | + return domain |
255 | + finally: |
256 | + f.close() |
257 | + |
258 | + |
259 | +def _auto_user_id(): |
260 | + """Calculate automatic user identification. |
261 | + |
262 | + :returns: (realname, email), either of which may be None if they can't be |
263 | + determined. |
264 | + |
265 | + Only used when none is set in the environment or the id file. |
266 | + |
267 | + This only returns an email address if we can be fairly sure the |
268 | + address is reasonable, ie if /etc/mailname is set on unix. |
269 | + |
270 | + This doesn't use the FQDN as the default domain because that may be |
271 | + slow, and it doesn't use the hostname alone because that's not normally |
272 | + a reasonable address. |
273 | + """ |
274 | + if sys.platform == 'win32': |
275 | + # No implementation to reliably determine Windows default mail |
276 | + # address; please add one. |
277 | + return None, None |
278 | + |
279 | + default_mail_domain = _get_default_mail_domain() |
280 | + if not default_mail_domain: |
281 | + return None, None |
282 | + |
283 | + import pwd |
284 | + uid = os.getuid() |
285 | + try: |
286 | + w = pwd.getpwuid(uid) |
287 | + except KeyError: |
288 | + mutter('no passwd entry for uid %d?' % uid) |
289 | + return None, None |
290 | + |
291 | + # we try utf-8 first, because on many variants (like Linux), |
292 | + # /etc/passwd "should" be in utf-8, and because it's unlikely to give |
293 | + # false positives. (many users will have their user encoding set to |
294 | + # latin-1, which cannot raise UnicodeError.) |
295 | + try: |
296 | + gecos = w.pw_gecos.decode('utf-8') |
297 | + encoding = 'utf-8' |
298 | + except UnicodeError: |
299 | + try: |
300 | + encoding = osutils.get_user_encoding() |
301 | + gecos = w.pw_gecos.decode(encoding) |
302 | + except UnicodeError, e: |
303 | + mutter("cannot decode passwd entry %s" % w) |
304 | + return None, None |
305 | + try: |
306 | + username = w.pw_name.decode(encoding) |
307 | + except UnicodeError, e: |
308 | + mutter("cannot decode passwd entry %s" % w) |
309 | + return None, None |
310 | + |
311 | + comma = gecos.find(',') |
312 | + if comma == -1: |
313 | + realname = gecos |
314 | + else: |
315 | + realname = gecos[:comma] |
316 | + |
317 | + return realname, (username + '@' + default_mail_domain) |
318 | + |
319 | + |
320 | def parse_username(username): |
321 | """Parse e-mail username and return a (name, address) tuple.""" |
322 | match = re.match(r'(.*?)\s*<?([\w+.-]+@[\w+.-]+)>?', username) |
323 | |
324 | === modified file 'bzrlib/controldir.py' |
325 | --- bzrlib/controldir.py 2011-02-03 18:58:06 +0000 |
326 | +++ bzrlib/controldir.py 2011-07-14 21:01:48 +0000 |
327 | @@ -503,6 +503,10 @@ |
328 | if br_to is None: |
329 | # We have a repository but no branch, copy the revisions, and then |
330 | # create a branch. |
331 | + if revision_id is None: |
332 | + # No revision supplied by the user, default to the branch |
333 | + # revision |
334 | + revision_id = source.last_revision() |
335 | repository_to.fetch(source.repository, revision_id=revision_id) |
336 | br_to = source.clone(self, revision_id=revision_id) |
337 | if source.get_push_location() is None or remember: |
338 | |
339 | === modified file 'bzrlib/crash.py' |
340 | --- bzrlib/crash.py 2010-10-11 02:21:33 +0000 |
341 | +++ bzrlib/crash.py 2011-07-14 21:01:48 +0000 |
342 | @@ -1,4 +1,4 @@ |
343 | -# Copyright (C) 2009, 2010 Canonical Ltd |
344 | +# Copyright (C) 2009-2011 Canonical Ltd |
345 | # |
346 | # This program is free software; you can redistribute it and/or modify |
347 | # it under the terms of the GNU General Public License as published by |
348 | @@ -84,19 +84,27 @@ |
349 | """Report a bug by just printing a message to the user.""" |
350 | trace.print_exception(exc_info, err_file) |
351 | err_file.write('\n') |
352 | - err_file.write('bzr %s on python %s (%s)\n' % \ |
353 | - (bzrlib.__version__, |
354 | - bzrlib._format_version_tuple(sys.version_info), |
355 | - platform.platform(aliased=1))) |
356 | - err_file.write('arguments: %r\n' % sys.argv) |
357 | - err_file.write( |
358 | + import textwrap |
359 | + def print_wrapped(l): |
360 | + err_file.write(textwrap.fill(l, |
361 | + width=78, subsequent_indent=' ') + '\n') |
362 | + print_wrapped('bzr %s on python %s (%s)\n' % \ |
363 | + (bzrlib.__version__, |
364 | + bzrlib._format_version_tuple(sys.version_info), |
365 | + platform.platform(aliased=1))) |
366 | + print_wrapped('arguments: %r\n' % sys.argv) |
367 | + print_wrapped(textwrap.fill( |
368 | + 'plugins: ' + plugin.format_concise_plugin_list(), |
369 | + width=78, |
370 | + subsequent_indent=' ', |
371 | + ) + '\n') |
372 | + print_wrapped( |
373 | 'encoding: %r, fsenc: %r, lang: %r\n' % ( |
374 | osutils.get_user_encoding(), sys.getfilesystemencoding(), |
375 | os.environ.get('LANG'))) |
376 | - err_file.write("plugins:\n") |
377 | - err_file.write(_format_plugin_list()) |
378 | + # We used to show all the plugins here, but it's too verbose. |
379 | err_file.write( |
380 | - "\n\n" |
381 | + "\n" |
382 | "*** Bazaar has encountered an internal error. This probably indicates a\n" |
383 | " bug in Bazaar. You can help us fix it by filing a bug report at\n" |
384 | " https://bugs.launchpad.net/bzr/+filebug\n" |
385 | |
386 | === modified file 'bzrlib/help_topics/en/configuration.txt' |
387 | --- bzrlib/help_topics/en/configuration.txt 2011-01-21 22:08:19 +0000 |
388 | +++ bzrlib/help_topics/en/configuration.txt 2011-07-14 21:01:48 +0000 |
389 | @@ -19,7 +19,9 @@ |
390 | BZR_PROGRESS_BAR |
391 | ~~~~~~~~~~~~~~~~ |
392 | |
393 | -Override the progress display. Possible values are "none", "dots", "tty" |
394 | +Override the progress display. Possible values are "none" or "text". If |
395 | +the value is "none" then no progress bar is displayed. The value "text" draws |
396 | +the ordinary command line progress bar. |
397 | |
398 | BZR_SIGQUIT_PDB |
399 | ~~~~~~~~~~~~~~~ |
400 | |
401 | === modified file 'bzrlib/inventory.py' |
402 | --- bzrlib/inventory.py 2010-09-20 11:30:28 +0000 |
403 | +++ bzrlib/inventory.py 2011-07-14 21:01:48 +0000 |
404 | @@ -1,4 +1,4 @@ |
405 | -# Copyright (C) 2005-2010 Canonical Ltd |
406 | +# Copyright (C) 2005-2011 Canonical Ltd |
407 | # |
408 | # This program is free software; you can redistribute it and/or modify |
409 | # it under the terms of the GNU General Public License as published by |
410 | @@ -718,6 +718,14 @@ |
411 | # if we finished all children, pop it off the stack |
412 | stack.pop() |
413 | |
414 | + def _preload_cache(self): |
415 | + """Populate any caches, we are about to access all items. |
416 | + |
417 | + The default implementation does nothing, because CommonInventory doesn't |
418 | + have a cache. |
419 | + """ |
420 | + pass |
421 | + |
422 | def iter_entries_by_dir(self, from_dir=None, specific_file_ids=None, |
423 | yield_parents=False): |
424 | """Iterate over the entries in a directory first order. |
425 | @@ -736,6 +744,11 @@ |
426 | specific_file_ids = set(specific_file_ids) |
427 | # TODO? Perhaps this should return the from_dir so that the root is |
428 | # yielded? or maybe an option? |
429 | + if from_dir is None and specific_file_ids is None: |
430 | + # They are iterating from the root, and have not specified any |
431 | + # specific entries to look at. All current callers fully consume the |
432 | + # iterator, so we can safely assume we are accessing all entries |
433 | + self._preload_cache() |
434 | if from_dir is None: |
435 | if self.root is None: |
436 | return |
437 | @@ -1390,6 +1403,7 @@ |
438 | def __init__(self, search_key_name): |
439 | CommonInventory.__init__(self) |
440 | self._fileid_to_entry_cache = {} |
441 | + self._fully_cached = False |
442 | self._path_to_fileid_cache = {} |
443 | self._search_key_name = search_key_name |
444 | self.root_id = None |
445 | @@ -1956,7 +1970,7 @@ |
446 | |
447 | def iter_just_entries(self): |
448 | """Iterate over all entries. |
449 | - |
450 | + |
451 | Unlike iter_entries(), just the entries are returned (not (path, ie)) |
452 | and the order of entries is undefined. |
453 | |
454 | @@ -1970,6 +1984,59 @@ |
455 | self._fileid_to_entry_cache[file_id] = ie |
456 | yield ie |
457 | |
458 | + def _preload_cache(self): |
459 | + """Make sure all file-ids are in _fileid_to_entry_cache""" |
460 | + if self._fully_cached: |
461 | + return # No need to do it again |
462 | + # The optimal sort order is to use iteritems() directly |
463 | + cache = self._fileid_to_entry_cache |
464 | + for key, entry in self.id_to_entry.iteritems(): |
465 | + file_id = key[0] |
466 | + if file_id not in cache: |
467 | + ie = self._bytes_to_entry(entry) |
468 | + cache[file_id] = ie |
469 | + else: |
470 | + ie = cache[file_id] |
471 | + last_parent_id = last_parent_ie = None |
472 | + pid_items = self.parent_id_basename_to_file_id.iteritems() |
473 | + for key, child_file_id in pid_items: |
474 | + if key == ('', ''): # This is the root |
475 | + if child_file_id != self.root_id: |
476 | + raise ValueError('Data inconsistency detected.' |
477 | + ' We expected data with key ("","") to match' |
478 | + ' the root id, but %s != %s' |
479 | + % (child_file_id, self.root_id)) |
480 | + continue |
481 | + parent_id, basename = key |
482 | + ie = cache[child_file_id] |
483 | + if parent_id == last_parent_id: |
484 | + parent_ie = last_parent_ie |
485 | + else: |
486 | + parent_ie = cache[parent_id] |
487 | + if parent_ie.kind != 'directory': |
488 | + raise ValueError('Data inconsistency detected.' |
489 | + ' An entry in the parent_id_basename_to_file_id map' |
490 | + ' has parent_id {%s} but the kind of that object' |
491 | + ' is %r not "directory"' % (parent_id, parent_ie.kind)) |
492 | + if parent_ie._children is None: |
493 | + parent_ie._children = {} |
494 | + basename = basename.decode('utf-8') |
495 | + if basename in parent_ie._children: |
496 | + existing_ie = parent_ie._children[basename] |
497 | + if existing_ie != ie: |
498 | + raise ValueError('Data inconsistency detected.' |
499 | + ' Two entries with basename %r were found' |
500 | + ' in the parent entry {%s}' |
501 | + % (basename, parent_id)) |
502 | + if basename != ie.name: |
503 | + raise ValueError('Data inconsistency detected.' |
504 | + ' In the parent_id_basename_to_file_id map, file_id' |
505 | + ' {%s} is listed as having basename %r, but in the' |
506 | + ' id_to_entry map it is %r' |
507 | + % (child_file_id, basename, ie.name)) |
508 | + parent_ie._children[basename] = ie |
509 | + self._fully_cached = True |
510 | + |
511 | def iter_changes(self, basis): |
512 | """Generate a Tree.iter_changes change list between this and basis. |
513 | |
514 | |
515 | === modified file 'bzrlib/lockdir.py' |
516 | --- bzrlib/lockdir.py 2011-01-21 22:08:19 +0000 |
517 | +++ bzrlib/lockdir.py 2011-07-14 21:01:48 +0000 |
518 | @@ -537,6 +537,17 @@ |
519 | hook(hook_result) |
520 | return result |
521 | |
522 | + def lock_url_for_display(self): |
523 | + """Give a nicely-printable representation of the URL of this lock.""" |
524 | + # As local lock urls are correct we display them. |
525 | + # We avoid displaying remote lock urls. |
526 | + lock_url = self.transport.abspath(self.path) |
527 | + if lock_url.startswith('file://'): |
528 | + lock_url = lock_url.split('.bzr/')[0] |
529 | + else: |
530 | + lock_url = '' |
531 | + return lock_url |
532 | + |
533 | def wait_lock(self, timeout=None, poll=None, max_attempts=None): |
534 | """Wait a certain period for a lock. |
535 | |
536 | @@ -566,6 +577,7 @@ |
537 | deadline_str = None |
538 | last_info = None |
539 | attempt_count = 0 |
540 | + lock_url = self.lock_url_for_display() |
541 | while True: |
542 | attempt_count += 1 |
543 | try: |
544 | @@ -590,13 +602,6 @@ |
545 | if deadline_str is None: |
546 | deadline_str = time.strftime('%H:%M:%S', |
547 | time.localtime(deadline)) |
548 | - # As local lock urls are correct we display them. |
549 | - # We avoid displaying remote lock urls. |
550 | - lock_url = self.transport.abspath(self.path) |
551 | - if lock_url.startswith('file://'): |
552 | - lock_url = lock_url.split('.bzr/')[0] |
553 | - else: |
554 | - lock_url = '' |
555 | user, hostname, pid, time_ago = formatted_info |
556 | msg = ('%s lock %s ' # lock_url |
557 | 'held by ' # start |
558 | |
559 | === modified file 'bzrlib/merge.py' |
560 | --- bzrlib/merge.py 2011-01-21 22:08:19 +0000 |
561 | +++ bzrlib/merge.py 2011-07-14 21:01:48 +0000 |
562 | @@ -1619,8 +1619,14 @@ |
563 | if other_parent is None or other_name is None: |
564 | other_path = '<deleted>' |
565 | else: |
566 | - parent_path = fp.get_path( |
567 | - self.tt.trans_id_file_id(other_parent)) |
568 | + if other_parent == self.other_tree.get_root_id(): |
569 | + # The tree transform doesn't know about the other root, |
570 | + # so we special case here to avoid a NoFinalPath |
571 | + # exception |
572 | + parent_path = '' |
573 | + else: |
574 | + parent_path = fp.get_path( |
575 | + self.tt.trans_id_file_id(other_parent)) |
576 | other_path = osutils.pathjoin(parent_path, other_name) |
577 | c = _mod_conflicts.Conflict.factory( |
578 | 'path conflict', path=this_path, |
579 | |
580 | === modified file 'bzrlib/osutils.py' |
581 | --- bzrlib/osutils.py 2011-02-23 14:55:32 +0000 |
582 | +++ bzrlib/osutils.py 2011-07-14 21:01:48 +0000 |
583 | @@ -2372,6 +2372,18 @@ |
584 | except UnicodeDecodeError: |
585 | raise errors.BzrError("Can't decode username as %s." % \ |
586 | user_encoding) |
587 | + except ImportError, e: |
588 | + if sys.platform != 'win32': |
589 | + raise |
590 | + if str(e) != 'No module named pwd': |
591 | + raise |
592 | + # https://bugs.launchpad.net/bzr/+bug/660174 |
593 | + # getpass.getuser() is unable to return username on Windows |
594 | + # if there is no USERNAME environment variable set. |
595 | + # That could be true if bzr is running as a service, |
596 | + # e.g. running `bzr serve` as a service on Windows. |
597 | + # We should not fail with traceback in this case. |
598 | + username = u'UNKNOWN' |
599 | return username |
600 | |
601 | |
602 | |
603 | === modified file 'bzrlib/plugin.py' |
604 | --- bzrlib/plugin.py 2010-09-20 11:30:28 +0000 |
605 | +++ bzrlib/plugin.py 2011-07-14 21:01:48 +0000 |
606 | @@ -1,4 +1,4 @@ |
607 | -# Copyright (C) 2005-2010 Canonical Ltd |
608 | +# Copyright (C) 2005-2011 Canonical Ltd |
609 | # |
610 | # This program is free software; you can redistribute it and/or modify |
611 | # it under the terms of the GNU General Public License as published by |
612 | @@ -400,6 +400,17 @@ |
613 | return result |
614 | |
615 | |
616 | +def format_concise_plugin_list(): |
617 | + """Return a string holding a concise list of plugins and their version. |
618 | + """ |
619 | + items = [] |
620 | + for name, a_plugin in sorted(plugins().items()): |
621 | + items.append("%s[%s]" % |
622 | + (name, a_plugin.__version__)) |
623 | + return ', '.join(items) |
624 | + |
625 | + |
626 | + |
627 | class PluginsHelpIndex(object): |
628 | """A help index that returns help topics for plugins.""" |
629 | |
630 | |
631 | === modified file 'bzrlib/plugins/launchpad/test_register.py' |
632 | --- bzrlib/plugins/launchpad/test_register.py 2011-01-21 22:08:19 +0000 |
633 | +++ bzrlib/plugins/launchpad/test_register.py 2011-07-14 21:01:48 +0000 |
634 | @@ -67,16 +67,19 @@ |
635 | """ |
636 | class FakeHttpResponse(object): |
637 | |
638 | - def __init__(self, status, reason, headers, body): |
639 | + def __init__(self, status, reason, body): |
640 | self.status = status |
641 | self.reason = reason |
642 | - self.headers = headers |
643 | self.body = body |
644 | |
645 | def read(self, size=-1): |
646 | return self.body.read(size) |
647 | |
648 | - return FakeHttpResponse(200, 'OK', [], self.getfile()) |
649 | + def getheader(self, name, default): |
650 | + # We don't have headers |
651 | + return default |
652 | + |
653 | + return FakeHttpResponse(200, 'OK', self.getfile()) |
654 | |
655 | def getfile(self): |
656 | """Return a fake file containing the response content.""" |
657 | |
658 | === modified file 'bzrlib/tests/__init__.py' |
659 | --- bzrlib/tests/__init__.py 2011-02-03 18:58:06 +0000 |
660 | +++ bzrlib/tests/__init__.py 2011-07-14 21:01:48 +0000 |
661 | @@ -1434,7 +1434,7 @@ |
662 | |
663 | def assertFileEqual(self, content, path): |
664 | """Fail if path does not contain 'content'.""" |
665 | - self.failUnlessExists(path) |
666 | + self.assertPathExists(path) |
667 | f = file(path, 'rb') |
668 | try: |
669 | s = f.read() |
670 | @@ -1451,20 +1451,28 @@ |
671 | self.assertEqual(expected_docstring, obj.__doc__) |
672 | |
673 | def failUnlessExists(self, path): |
674 | + return self.assertPathExists(path) |
675 | + |
676 | + def assertPathExists(self, path): |
677 | """Fail unless path or paths, which may be abs or relative, exist.""" |
678 | if not isinstance(path, basestring): |
679 | for p in path: |
680 | - self.failUnlessExists(p) |
681 | + self.assertPathExists(p) |
682 | else: |
683 | - self.failUnless(osutils.lexists(path),path+" does not exist") |
684 | + self.assertTrue(osutils.lexists(path), |
685 | + path + " does not exist") |
686 | |
687 | def failIfExists(self, path): |
688 | + return self.assertPathDoesNotExist(path) |
689 | + |
690 | + def assertPathDoesNotExist(self, path): |
691 | """Fail if path or paths, which may be abs or relative, exist.""" |
692 | if not isinstance(path, basestring): |
693 | for p in path: |
694 | - self.failIfExists(p) |
695 | + self.assertPathDoesNotExist(p) |
696 | else: |
697 | - self.failIf(osutils.lexists(path),path+" exists") |
698 | + self.assertFalse(osutils.lexists(path), |
699 | + path + " exists") |
700 | |
701 | def _capture_deprecation_warnings(self, a_callable, *args, **kwargs): |
702 | """A helper for callDeprecated and applyDeprecated. |
703 | |
704 | === modified file 'bzrlib/tests/blackbox/test_bound_branches.py' |
705 | --- bzrlib/tests/blackbox/test_bound_branches.py 2010-11-05 23:21:04 +0000 |
706 | +++ bzrlib/tests/blackbox/test_bound_branches.py 2011-07-14 21:01:48 +0000 |
707 | @@ -371,7 +371,7 @@ |
708 | |
709 | child_tree.merge_from_branch(other_branch) |
710 | |
711 | - self.failUnlessExists('child/c') |
712 | + self.assertPathExists('child/c') |
713 | self.assertEqual([new_rev_id], child_tree.get_parent_ids()[1:]) |
714 | |
715 | # Make sure the local branch has the installed revision |
716 | |
717 | === modified file 'bzrlib/tests/blackbox/test_branch.py' |
718 | --- bzrlib/tests/blackbox/test_branch.py 2011-01-21 22:08:19 +0000 |
719 | +++ bzrlib/tests/blackbox/test_branch.py 2011-07-14 21:01:48 +0000 |
720 | @@ -180,7 +180,7 @@ |
721 | source.add('file1') |
722 | source.commit('added file') |
723 | out, err = self.run_bzr('branch source target --files-from source') |
724 | - self.failUnlessExists('target/file1') |
725 | + self.assertPathExists('target/file1') |
726 | |
727 | def test_branch_files_from_hardlink(self): |
728 | self.requireFeature(HardlinkFeature) |
729 | @@ -209,8 +209,8 @@ |
730 | def test_branch_no_tree(self): |
731 | self.example_branch('source') |
732 | self.run_bzr('branch --no-tree source target') |
733 | - self.failIfExists('target/hello') |
734 | - self.failIfExists('target/goodbye') |
735 | + self.assertPathDoesNotExist('target/hello') |
736 | + self.assertPathDoesNotExist('target/goodbye') |
737 | |
738 | def test_branch_into_existing_dir(self): |
739 | self.example_branch('a') |
740 | @@ -226,8 +226,8 @@ |
741 | # force operation |
742 | self.run_bzr('branch a b --use-existing-dir') |
743 | # check conflicts |
744 | - self.failUnlessExists('b/hello.moved') |
745 | - self.failIfExists('b/godbye.moved') |
746 | + self.assertPathExists('b/hello.moved') |
747 | + self.assertPathDoesNotExist('b/godbye.moved') |
748 | # we can't branch into branch |
749 | out,err = self.run_bzr('branch a b --use-existing-dir', retcode=3) |
750 | self.assertEqual('', out) |
751 | |
752 | === modified file 'bzrlib/tests/blackbox/test_checkout.py' |
753 | --- bzrlib/tests/blackbox/test_checkout.py 2010-09-20 11:30:28 +0000 |
754 | +++ bzrlib/tests/blackbox/test_checkout.py 2011-07-14 21:01:48 +0000 |
755 | @@ -69,7 +69,7 @@ |
756 | # from 1. |
757 | result = bzrdir.BzrDir.open('checkout') |
758 | self.assertEqual(['1'], result.open_workingtree().get_parent_ids()) |
759 | - self.failIfExists('checkout/added_in_2') |
760 | + self.assertPathDoesNotExist('checkout/added_in_2') |
761 | |
762 | def test_checkout_light_dash_r(self): |
763 | out, err = self.run_bzr(['checkout','--lightweight', '-r', '-2', |
764 | @@ -78,7 +78,7 @@ |
765 | # from 1. |
766 | result = bzrdir.BzrDir.open('checkout') |
767 | self.assertEqual(['1'], result.open_workingtree().get_parent_ids()) |
768 | - self.failIfExists('checkout/added_in_2') |
769 | + self.assertPathDoesNotExist('checkout/added_in_2') |
770 | |
771 | def test_checkout_reconstitutes_working_trees(self): |
772 | # doing a 'bzr checkout' in the directory of a branch with no tree |
773 | @@ -124,9 +124,9 @@ |
774 | cmd.append('--lightweight') |
775 | self.run_bzr('checkout source target') |
776 | # files with unique content should be moved |
777 | - self.failUnlessExists('target/file2.moved') |
778 | + self.assertPathExists('target/file2.moved') |
779 | # files with content matching tree should not be moved |
780 | - self.failIfExists('target/file1.moved') |
781 | + self.assertPathDoesNotExist('target/file1.moved') |
782 | |
783 | def test_checkout_existing_dir_heavy(self): |
784 | self._test_checkout_existing_dir(False) |
785 | |
786 | === modified file 'bzrlib/tests/blackbox/test_clean_tree.py' |
787 | --- bzrlib/tests/blackbox/test_clean_tree.py 2010-09-20 11:30:28 +0000 |
788 | +++ bzrlib/tests/blackbox/test_clean_tree.py 2011-07-14 21:01:48 +0000 |
789 | @@ -41,28 +41,28 @@ |
790 | self.run_bzr('ignore *.pyc') |
791 | self.touch('name') |
792 | self.touch('name~') |
793 | - self.failUnlessExists('name~') |
794 | + self.assertPathExists('name~') |
795 | self.touch('name.pyc') |
796 | self.run_bzr('clean-tree --force') |
797 | - self.failUnlessExists('name~') |
798 | - self.failIfExists('name') |
799 | + self.assertPathExists('name~') |
800 | + self.assertPathDoesNotExist('name') |
801 | self.touch('name') |
802 | self.run_bzr('clean-tree --detritus --force') |
803 | - self.failUnlessExists('name') |
804 | - self.failIfExists('name~') |
805 | - self.failUnlessExists('name.pyc') |
806 | + self.assertPathExists('name') |
807 | + self.assertPathDoesNotExist('name~') |
808 | + self.assertPathExists('name.pyc') |
809 | self.run_bzr('clean-tree --ignored --force') |
810 | - self.failUnlessExists('name') |
811 | - self.failIfExists('name.pyc') |
812 | + self.assertPathExists('name') |
813 | + self.assertPathDoesNotExist('name.pyc') |
814 | self.run_bzr('clean-tree --unknown --force') |
815 | - self.failIfExists('name') |
816 | + self.assertPathDoesNotExist('name') |
817 | self.touch('name') |
818 | self.touch('name~') |
819 | self.touch('name.pyc') |
820 | self.run_bzr('clean-tree --unknown --ignored --force') |
821 | - self.failIfExists('name') |
822 | - self.failIfExists('name~') |
823 | - self.failIfExists('name.pyc') |
824 | + self.assertPathDoesNotExist('name') |
825 | + self.assertPathDoesNotExist('name~') |
826 | + self.assertPathDoesNotExist('name.pyc') |
827 | |
828 | def test_clean_tree_nested_bzrdir(self): |
829 | # clean-tree should not blindly delete nested bzrdirs (branches) |
830 | @@ -73,11 +73,11 @@ |
831 | wt3 = self.make_branch_and_tree('bar') |
832 | ignores.tree_ignores_add_patterns(wt1, ['./foo']) |
833 | self.run_bzr(['clean-tree', '--unknown', '--force']) |
834 | - self.failUnlessExists('foo') |
835 | - self.failUnlessExists('bar') |
836 | + self.assertPathExists('foo') |
837 | + self.assertPathExists('bar') |
838 | self.run_bzr(['clean-tree', '--ignored', '--force']) |
839 | - self.failUnlessExists('foo') |
840 | - self.failUnlessExists('bar') |
841 | + self.assertPathExists('foo') |
842 | + self.assertPathExists('bar') |
843 | |
844 | def test_clean_tree_directory(self): |
845 | """Test --directory option""" |
846 | @@ -85,6 +85,6 @@ |
847 | self.build_tree(['a/added', 'a/unknown', 'a/ignored']) |
848 | tree.add('added') |
849 | self.run_bzr('clean-tree -d a --unknown --ignored --force') |
850 | - self.failIfExists('a/unknown') |
851 | - self.failIfExists('a/ignored') |
852 | - self.failUnlessExists('a/added') |
853 | + self.assertPathDoesNotExist('a/unknown') |
854 | + self.assertPathDoesNotExist('a/ignored') |
855 | + self.assertPathExists('a/added') |
856 | |
857 | === modified file 'bzrlib/tests/blackbox/test_commit.py' |
858 | --- bzrlib/tests/blackbox/test_commit.py 2011-01-21 22:08:19 +0000 |
859 | +++ bzrlib/tests/blackbox/test_commit.py 2011-07-14 21:01:48 +0000 |
860 | @@ -23,6 +23,7 @@ |
861 | |
862 | from bzrlib import ( |
863 | bzrdir, |
864 | + config, |
865 | osutils, |
866 | ignores, |
867 | msgeditor, |
868 | @@ -758,6 +759,9 @@ |
869 | self.run_bzr(['add']) |
870 | self.overrideEnv('EMAIL', None) |
871 | self.overrideEnv('BZR_EMAIL', None) |
872 | + # Also, make sure that it's not inferred from mailname. |
873 | + self.overrideAttr(config, '_auto_user_id', |
874 | + lambda: (None, None)) |
875 | out, err = self.run_bzr(['commit', '-m', 'initial'], 3) |
876 | self.assertContainsRe(err, 'Unable to determine your name') |
877 | |
878 | |
879 | === modified file 'bzrlib/tests/blackbox/test_export.py' |
880 | --- bzrlib/tests/blackbox/test_export.py 2010-10-11 02:21:33 +0000 |
881 | +++ bzrlib/tests/blackbox/test_export.py 2011-07-14 21:01:48 +0000 |
882 | @@ -48,10 +48,10 @@ |
883 | self.run_bzr('ignore something') |
884 | tree.commit('1') |
885 | |
886 | - self.failUnless(tree.has_filename('.bzrignore')) |
887 | - self.failUnless(tree.has_filename('.bzrrules')) |
888 | - self.failUnless(tree.has_filename('.bzr-adir')) |
889 | - self.failUnless(tree.has_filename('.bzr-adir/afile')) |
890 | + self.assertTrue(tree.has_filename('.bzrignore')) |
891 | + self.assertTrue(tree.has_filename('.bzrrules')) |
892 | + self.assertTrue(tree.has_filename('.bzr-adir')) |
893 | + self.assertTrue(tree.has_filename('.bzr-adir/afile')) |
894 | self.run_bzr('export test.tar.gz') |
895 | ball = tarfile.open('test.tar.gz') |
896 | # Make sure the tarball contains 'a', but does not contain |
897 | @@ -106,11 +106,11 @@ |
898 | self.run_bzr('ignore something') |
899 | tree.commit('1') |
900 | |
901 | - self.failUnless(tree.has_filename('.bzrignore')) |
902 | - self.failUnless(tree.has_filename('.bzrrules')) |
903 | - self.failUnless(tree.has_filename('.bzr-adir')) |
904 | - self.failUnless(tree.has_filename('.bzr-adir/afile')) |
905 | self.run_bzr('export test.zip') |
906 | + self.assertTrue(tree.has_filename('.bzrignore')) |
907 | + self.assertTrue(tree.has_filename('.bzrrules')) |
908 | + self.assertTrue(tree.has_filename('.bzr-adir')) |
909 | + self.assertTrue(tree.has_filename('.bzr-adir/afile')) |
910 | |
911 | zfile = zipfile.ZipFile('test.zip') |
912 | # Make sure the zipfile contains 'a', but does not contain |
913 | @@ -175,10 +175,10 @@ |
914 | self.run_bzr('ignore something') |
915 | tree.commit('1') |
916 | |
917 | - self.failUnless(tree.has_filename('.bzrignore')) |
918 | - self.failUnless(tree.has_filename('.bzrrules')) |
919 | - self.failUnless(tree.has_filename('.bzr-adir')) |
920 | - self.failUnless(tree.has_filename('.bzr-adir/afile')) |
921 | + self.assertTrue(tree.has_filename('.bzrignore')) |
922 | + self.assertTrue(tree.has_filename('.bzrrules')) |
923 | + self.assertTrue(tree.has_filename('.bzr-adir')) |
924 | + self.assertTrue(tree.has_filename('.bzr-adir/afile')) |
925 | self.run_bzr('export direxport') |
926 | |
927 | files = sorted(os.listdir('direxport')) |
928 | @@ -221,7 +221,7 @@ |
929 | os.chdir('branch') |
930 | |
931 | self.run_bzr('export ../first.tar -r 1') |
932 | - self.failUnless(os.path.isfile('../first.tar')) |
933 | + self.assertTrue(os.path.isfile('../first.tar')) |
934 | tf = tarfile.open('../first.tar') |
935 | try: |
936 | self.assertEqual(['first/hello'], sorted(tf.getnames())) |
937 | @@ -230,13 +230,13 @@ |
938 | tf.close() |
939 | |
940 | self.run_bzr('export ../first.tar.gz -r 1') |
941 | - self.failUnless(os.path.isfile('../first.tar.gz')) |
942 | + self.assertTrue(os.path.isfile('../first.tar.gz')) |
943 | self.run_bzr('export ../first.tbz2 -r 1') |
944 | - self.failUnless(os.path.isfile('../first.tbz2')) |
945 | + self.assertTrue(os.path.isfile('../first.tbz2')) |
946 | self.run_bzr('export ../first.tar.bz2 -r 1') |
947 | - self.failUnless(os.path.isfile('../first.tar.bz2')) |
948 | + self.assertTrue(os.path.isfile('../first.tar.bz2')) |
949 | self.run_bzr('export ../first.tar.tbz2 -r 1') |
950 | - self.failUnless(os.path.isfile('../first.tar.tbz2')) |
951 | + self.assertTrue(os.path.isfile('../first.tar.tbz2')) |
952 | |
953 | tf = tarfile.open('../first.tar.tbz2', 'r:bz2') |
954 | try: |
955 | @@ -257,7 +257,7 @@ |
956 | os.chdir('branch') |
957 | |
958 | self.run_bzr('export ../first.zip -r 1') |
959 | - self.failUnlessExists('../first.zip') |
960 | + self.assertPathExists('../first.zip') |
961 | zf = zipfile.ZipFile('../first.zip') |
962 | try: |
963 | self.assertEqual(['first/hello'], sorted(zf.namelist())) |
964 | |
965 | === modified file 'bzrlib/tests/blackbox/test_init.py' |
966 | --- bzrlib/tests/blackbox/test_init.py 2011-01-21 22:08:19 +0000 |
967 | +++ bzrlib/tests/blackbox/test_init.py 2011-07-14 21:01:48 +0000 |
968 | @@ -108,7 +108,7 @@ |
969 | # init an existing branch. |
970 | out, err = self.run_bzr('init subdir2', retcode=3) |
971 | self.assertEqual('', out) |
972 | - self.failUnless(err.startswith('bzr: ERROR: Already a branch:')) |
973 | + self.assertTrue(err.startswith('bzr: ERROR: Already a branch:')) |
974 | |
975 | def test_init_branch_quiet(self): |
976 | out, err = self.run_bzr('init -q') |
977 | @@ -162,7 +162,7 @@ |
978 | self.run_bzr_error(['Parent directory of ../new/tree does not exist'], |
979 | 'init ../new/tree', working_dir='tree') |
980 | self.run_bzr('init ../new/tree --create-prefix', working_dir='tree') |
981 | - self.failUnlessExists('new/tree/.bzr') |
982 | + self.assertPathExists('new/tree/.bzr') |
983 | |
984 | def test_init_default_format_option(self): |
985 | """bzr init should read default format from option default_format""" |
986 | |
987 | === modified file 'bzrlib/tests/blackbox/test_merge.py' |
988 | --- bzrlib/tests/blackbox/test_merge.py 2011-01-21 22:08:19 +0000 |
989 | +++ bzrlib/tests/blackbox/test_merge.py 2011-07-14 21:01:48 +0000 |
990 | @@ -19,8 +19,11 @@ |
991 | """Black-box tests for bzr merge. |
992 | """ |
993 | |
994 | +import doctest |
995 | import os |
996 | |
997 | +from testtools import matchers |
998 | + |
999 | from bzrlib import ( |
1000 | branch, |
1001 | branchbuilder, |
1002 | @@ -102,7 +105,7 @@ |
1003 | # Merging a branch pulls its revision into the tree |
1004 | b = branch.Branch.open('../b') |
1005 | b_tip = b.last_revision() |
1006 | - self.failUnless(a.branch.repository.has_revision(b_tip)) |
1007 | + self.assertTrue(a.branch.repository.has_revision(b_tip)) |
1008 | self.assertEqual([a_tip, b_tip], a.get_parent_ids()) |
1009 | a_tree.revert(backups=False) |
1010 | out, err = self.run_bzr('merge -r revno:1:./hello', retcode=3) |
1011 | @@ -204,12 +207,12 @@ |
1012 | b_tree.commit(message='Modified a.txt') |
1013 | os.chdir('b') |
1014 | self.run_bzr('merge ../a/', retcode=1) |
1015 | - self.failUnlessExists('sub/a.txt.THIS') |
1016 | - self.failUnlessExists('sub/a.txt.BASE') |
1017 | + self.assertPathExists('sub/a.txt.THIS') |
1018 | + self.assertPathExists('sub/a.txt.BASE') |
1019 | os.chdir('../a') |
1020 | self.run_bzr('merge ../b/', retcode=1) |
1021 | - self.failUnlessExists('sub/a.txt.OTHER') |
1022 | - self.failUnlessExists('sub/a.txt.BASE') |
1023 | + self.assertPathExists('sub/a.txt.OTHER') |
1024 | + self.assertPathExists('sub/a.txt.BASE') |
1025 | |
1026 | def test_conflict_leaves_base_this_other_files(self): |
1027 | tree, other = self.create_conflicting_branches() |
1028 | @@ -326,14 +329,14 @@ |
1029 | tree_a.add(['file_1', 'file_2']) |
1030 | tree_a.commit('commit 1') |
1031 | tree_b = tree_a.bzrdir.sprout('b').open_workingtree() |
1032 | - self.failUnlessExists('b/file_1') |
1033 | + self.assertPathExists('b/file_1') |
1034 | tree_a.rename_one('file_1', 'file_i') |
1035 | tree_a.commit('commit 2') |
1036 | tree_a.rename_one('file_2', 'file_ii') |
1037 | ## os.chdir('b') |
1038 | self.run_bzr('merge a --uncommitted -d b') |
1039 | - self.failUnlessExists('b/file_1') |
1040 | - self.failUnlessExists('b/file_ii') |
1041 | + self.assertPathExists('b/file_1') |
1042 | + self.assertPathExists('b/file_ii') |
1043 | tree_b.revert() |
1044 | self.run_bzr_error(('Cannot use --uncommitted and --revision',), |
1045 | 'merge /a --uncommitted -r1 -d b') |
1046 | @@ -347,18 +350,18 @@ |
1047 | tree_a.add(['file1', 'file2']) |
1048 | os.chdir('tree_b') |
1049 | self.run_bzr(['merge', '--uncommitted', '../tree_a/file1']) |
1050 | - self.failUnlessExists('file1') |
1051 | - self.failIfExists('file2') |
1052 | + self.assertPathExists('file1') |
1053 | + self.assertPathDoesNotExist('file2') |
1054 | |
1055 | def pullable_branch(self): |
1056 | tree_a = self.make_branch_and_tree('a') |
1057 | - self.build_tree(['a/file']) |
1058 | + self.build_tree_contents([('a/file', 'bar\n')]) |
1059 | tree_a.add(['file']) |
1060 | self.id1 = tree_a.commit('commit 1') |
1061 | |
1062 | tree_b = self.make_branch_and_tree('b') |
1063 | tree_b.pull(tree_a.branch) |
1064 | - file('b/file', 'wb').write('foo') |
1065 | + self.build_tree_contents([('b/file', 'foo\n')]) |
1066 | self.id2 = tree_b.commit('commit 2') |
1067 | |
1068 | def test_merge_pull(self): |
1069 | @@ -369,6 +372,21 @@ |
1070 | tree_a = workingtree.WorkingTree.open('.') |
1071 | self.assertEqual([self.id2], tree_a.get_parent_ids()) |
1072 | |
1073 | + def test_merge_pull_preview(self): |
1074 | + self.pullable_branch() |
1075 | + (out, err) = self.run_bzr('merge --pull --preview -d a b') |
1076 | + self.assertThat(out, matchers.DocTestMatches( |
1077 | +"""=== modified file 'file' |
1078 | +--- file\t... |
1079 | ++++ file\t... |
1080 | +@@ -1,1 +1,1 @@ |
1081 | +-bar |
1082 | ++foo |
1083 | + |
1084 | +""", doctest.ELLIPSIS | doctest.REPORT_UDIFF)) |
1085 | + tree_a = workingtree.WorkingTree.open('a') |
1086 | + self.assertEqual([self.id1], tree_a.get_parent_ids()) |
1087 | + |
1088 | def test_merge_kind_change(self): |
1089 | tree_a = self.make_branch_and_tree('tree_a') |
1090 | self.build_tree_contents([('tree_a/file', 'content_1')]) |
1091 | @@ -408,8 +426,8 @@ |
1092 | self.write_directive('directive', source.branch, 'target', 'rev2', |
1093 | 'rev1') |
1094 | out, err = self.run_bzr('merge -d target directive') |
1095 | - self.failIfExists('target/a') |
1096 | - self.failUnlessExists('target/b') |
1097 | + self.assertPathDoesNotExist('target/a') |
1098 | + self.assertPathExists('target/b') |
1099 | self.assertContainsRe(err, 'Performing cherrypick') |
1100 | |
1101 | def write_directive(self, filename, source, target, revision_id, |
1102 | @@ -450,19 +468,19 @@ |
1103 | branch_b.add('file2') |
1104 | branch_b.commit('added file2', rev_id='rev2b') |
1105 | branch_b.merge_from_branch(branch_a.branch) |
1106 | - self.failUnlessExists('branch_b/file1') |
1107 | + self.assertPathExists('branch_b/file1') |
1108 | branch_b.commit('merged branch_a', rev_id='rev3b') |
1109 | |
1110 | # It works if the revid has an interger revno |
1111 | self.run_bzr('merge -d target -r revid:rev2a branch_a') |
1112 | - self.failUnlessExists('target/file1') |
1113 | - self.failIfExists('target/file2') |
1114 | + self.assertPathExists('target/file1') |
1115 | + self.assertPathDoesNotExist('target/file2') |
1116 | target.revert() |
1117 | |
1118 | # It should work if the revid has no integer revno |
1119 | self.run_bzr('merge -d target -r revid:rev2a branch_b') |
1120 | - self.failUnlessExists('target/file1') |
1121 | - self.failIfExists('target/file2') |
1122 | + self.assertPathExists('target/file1') |
1123 | + self.assertPathDoesNotExist('target/file2') |
1124 | |
1125 | def assertDirectoryContent(self, directory, entries, message=''): |
1126 | """Assert whether entries (file or directories) exist in a directory. |
1127 | @@ -603,7 +621,7 @@ |
1128 | other.add('other_file') |
1129 | other.commit('rev1b') |
1130 | self.run_bzr('merge -d this other -r0..') |
1131 | - self.failUnlessExists('this/other_file') |
1132 | + self.assertPathExists('this/other_file') |
1133 | |
1134 | def test_merge_interactive_unlocks_branch(self): |
1135 | this = self.make_branch_and_tree('this') |
1136 | @@ -621,9 +639,9 @@ |
1137 | tree.commit("added "+f) |
1138 | for context in (".", "", "a"): |
1139 | self.run_bzr("merge -r 1..0 " + context) |
1140 | - self.failIfExists("a") |
1141 | + self.assertPathDoesNotExist("a") |
1142 | tree.revert() |
1143 | - self.failUnlessExists("a") |
1144 | + self.assertPathExists("a") |
1145 | |
1146 | |
1147 | class TestMergeForce(tests.TestCaseWithTransport): |
1148 | |
1149 | === modified file 'bzrlib/tests/blackbox/test_mv.py' |
1150 | --- bzrlib/tests/blackbox/test_mv.py 2010-03-24 22:27:38 +0000 |
1151 | +++ bzrlib/tests/blackbox/test_mv.py 2011-07-14 21:01:48 +0000 |
1152 | @@ -35,10 +35,10 @@ |
1153 | |
1154 | def assertMoved(self,from_path,to_path): |
1155 | """Assert that to_path is existing and versioned but from_path not. """ |
1156 | - self.failIfExists(from_path) |
1157 | + self.assertPathDoesNotExist(from_path) |
1158 | self.assertNotInWorkingTree(from_path) |
1159 | |
1160 | - self.failUnlessExists(to_path) |
1161 | + self.assertPathExists(to_path) |
1162 | self.assertInWorkingTree(to_path) |
1163 | |
1164 | def test_mv_modes(self): |
1165 | @@ -119,7 +119,7 @@ |
1166 | |
1167 | os.chdir('sub1/sub2') |
1168 | self.run_bzr('mv ../hello.txt .') |
1169 | - self.failUnlessExists('./hello.txt') |
1170 | + self.assertPathExists('./hello.txt') |
1171 | |
1172 | os.chdir('..') |
1173 | self.run_bzr('mv sub2/hello.txt .') |
1174 | @@ -229,8 +229,8 @@ |
1175 | ["^bzr: ERROR: Could not move a => b. b is already versioned\.$"], |
1176 | 'mv a b') |
1177 | #check that nothing changed |
1178 | - self.failIfExists('a') |
1179 | - self.failUnlessExists('b') |
1180 | + self.assertPathDoesNotExist('a') |
1181 | + self.assertPathExists('b') |
1182 | |
1183 | def test_mv_already_moved_file_into_subdir(self): |
1184 | """Test bzr mv original_file to versioned_directory/file. |
1185 | @@ -264,8 +264,8 @@ |
1186 | self.run_bzr_error( |
1187 | ["^bzr: ERROR: Could not move a => a: sub is not versioned\.$"], |
1188 | 'mv a sub/a') |
1189 | - self.failIfExists('a') |
1190 | - self.failUnlessExists('sub/a') |
1191 | + self.assertPathDoesNotExist('a') |
1192 | + self.assertPathExists('sub/a') |
1193 | |
1194 | def test_mv_already_moved_files_into_subdir(self): |
1195 | """Test bzr mv original_files to versioned_directory. |
1196 | @@ -300,10 +300,10 @@ |
1197 | self.run_bzr_error( |
1198 | ["^bzr: ERROR: Could not move to sub. sub is not versioned\.$"], |
1199 | 'mv a1 a2 sub') |
1200 | - self.failIfExists('a1') |
1201 | - self.failUnlessExists('sub/a1') |
1202 | - self.failUnlessExists('a2') |
1203 | - self.failIfExists('sub/a2') |
1204 | + self.assertPathDoesNotExist('a1') |
1205 | + self.assertPathExists('sub/a1') |
1206 | + self.assertPathExists('a2') |
1207 | + self.assertPathDoesNotExist('sub/a2') |
1208 | |
1209 | def test_mv_already_moved_file_forcing_after(self): |
1210 | """Test bzr mv versioned_file to unversioned_file. |
1211 | @@ -325,8 +325,8 @@ |
1212 | " \(Use --after to tell bzr about a rename that has already" |
1213 | " happened\)$"], |
1214 | 'mv a b') |
1215 | - self.failUnlessExists('a') |
1216 | - self.failUnlessExists('b') |
1217 | + self.assertPathExists('a') |
1218 | + self.assertPathExists('b') |
1219 | |
1220 | def test_mv_already_moved_file_using_after(self): |
1221 | """Test bzr mv --after versioned_file to unversioned_file. |
1222 | @@ -346,9 +346,9 @@ |
1223 | self.build_tree(['a']) #touch a |
1224 | |
1225 | self.run_bzr('mv a b --after') |
1226 | - self.failUnlessExists('a') |
1227 | + self.assertPathExists('a') |
1228 | self.assertNotInWorkingTree('a')#a should be unknown now. |
1229 | - self.failUnlessExists('b') |
1230 | + self.assertPathExists('b') |
1231 | self.assertInWorkingTree('b') |
1232 | |
1233 | def test_mv_already_moved_files_forcing_after(self): |
1234 | @@ -375,10 +375,10 @@ |
1235 | " exist. \(Use --after to tell bzr about a rename that has already" |
1236 | " happened\)$"], |
1237 | 'mv a1 a2 sub') |
1238 | - self.failUnlessExists('a1') |
1239 | - self.failUnlessExists('a2') |
1240 | - self.failUnlessExists('sub/a1') |
1241 | - self.failUnlessExists('sub/a2') |
1242 | + self.assertPathExists('a1') |
1243 | + self.assertPathExists('a2') |
1244 | + self.assertPathExists('sub/a1') |
1245 | + self.assertPathExists('sub/a2') |
1246 | |
1247 | def test_mv_already_moved_files_using_after(self): |
1248 | """Test bzr mv --after versioned_file to directory/unversioned_file. |
1249 | @@ -402,10 +402,10 @@ |
1250 | self.build_tree(['a2']) #touch a2 |
1251 | |
1252 | self.run_bzr('mv a1 a2 sub --after') |
1253 | - self.failUnlessExists('a1') |
1254 | - self.failUnlessExists('a2') |
1255 | - self.failUnlessExists('sub/a1') |
1256 | - self.failUnlessExists('sub/a2') |
1257 | + self.assertPathExists('a1') |
1258 | + self.assertPathExists('a2') |
1259 | + self.assertPathExists('sub/a1') |
1260 | + self.assertPathExists('sub/a2') |
1261 | self.assertInWorkingTree('sub/a1') |
1262 | self.assertInWorkingTree('sub/a2') |
1263 | |
1264 | @@ -421,15 +421,15 @@ |
1265 | osutils.rename('c', 'd') |
1266 | # mv a b should work just like it does for already renamed files |
1267 | self.run_bzr('mv a b') |
1268 | - self.failIfExists('a') |
1269 | + self.assertPathDoesNotExist('a') |
1270 | self.assertNotInWorkingTree('a') |
1271 | - self.failUnlessExists('b') |
1272 | + self.assertPathExists('b') |
1273 | self.assertInWorkingTree('b') |
1274 | # and --after should work, too (technically it's ignored) |
1275 | self.run_bzr('mv --after c d') |
1276 | - self.failIfExists('c') |
1277 | + self.assertPathDoesNotExist('c') |
1278 | self.assertNotInWorkingTree('c') |
1279 | - self.failUnlessExists('d') |
1280 | + self.assertPathExists('d') |
1281 | self.assertInWorkingTree('d') |
1282 | |
1283 | def make_abcd_tree(self): |
1284 | |
1285 | === modified file 'bzrlib/tests/blackbox/test_non_ascii.py' |
1286 | --- bzrlib/tests/blackbox/test_non_ascii.py 2011-01-21 22:08:19 +0000 |
1287 | +++ bzrlib/tests/blackbox/test_non_ascii.py 2011-07-14 21:01:48 +0000 |
1288 | @@ -161,12 +161,12 @@ |
1289 | def test_cat_revision(self): |
1290 | committer = self.info['committer'] |
1291 | txt = self.run_bzr_decode('cat-revision -r 1') |
1292 | - self.failUnless(committer in txt, |
1293 | + self.assertTrue(committer in txt, |
1294 | 'failed to find %r in %r' % (committer, txt)) |
1295 | |
1296 | msg = self.info['message'] |
1297 | txt = self.run_bzr_decode('cat-revision -r 2') |
1298 | - self.failUnless(msg in txt, 'failed to find %r in %r' % (msg, txt)) |
1299 | + self.assertTrue(msg in txt, 'failed to find %r in %r' % (msg, txt)) |
1300 | |
1301 | def test_mkdir(self): |
1302 | txt = self.run_bzr_decode(['mkdir', self.info['directory']]) |
1303 | @@ -222,8 +222,8 @@ |
1304 | |
1305 | txt = self.run_bzr_decode(['mv', 'a', fname2]) |
1306 | self.assertEqual(u'a => %s\n' % fname2, txt) |
1307 | - self.failIfExists('a') |
1308 | - self.failUnlessExists(fname2) |
1309 | + self.assertPathDoesNotExist('a') |
1310 | + self.assertPathExists(fname2) |
1311 | |
1312 | # After 'mv' we need to re-open the working tree |
1313 | self.wt = self.wt.bzrdir.open_workingtree() |
1314 | @@ -240,7 +240,7 @@ |
1315 | # The rename should still succeed |
1316 | newpath = u'%s/%s' % (dirname, fname2) |
1317 | txt = self.run_bzr_decode(['mv', newpath, 'a'], encoding='ascii') |
1318 | - self.failUnlessExists('a') |
1319 | + self.assertPathExists('a') |
1320 | self.assertEqual(newpath.encode('ascii', 'replace') + ' => a\n', txt) |
1321 | |
1322 | def test_branch(self): |
1323 | @@ -386,7 +386,7 @@ |
1324 | self.assertEqual(fname+'\n', txt) |
1325 | |
1326 | txt = self.run_bzr_decode('deleted --show-ids') |
1327 | - self.failUnless(txt.startswith(fname)) |
1328 | + self.assertTrue(txt.startswith(fname)) |
1329 | |
1330 | # Deleted should fail if cannot decode |
1331 | # Because it is giving the exact paths |
1332 | @@ -421,7 +421,7 @@ |
1333 | self.wt.bzrdir.sprout(url) |
1334 | |
1335 | txt = self.run_bzr_decode('root', working_dir=dirname) |
1336 | - self.failUnless(txt.endswith(dirname+'\n')) |
1337 | + self.assertTrue(txt.endswith(dirname+'\n')) |
1338 | |
1339 | txt = self.run_bzr_decode('root', encoding='ascii', fail=True, |
1340 | working_dir=dirname) |
1341 | |
1342 | === modified file 'bzrlib/tests/blackbox/test_push.py' |
1343 | --- bzrlib/tests/blackbox/test_push.py 2011-01-21 22:08:19 +0000 |
1344 | +++ bzrlib/tests/blackbox/test_push.py 2011-07-14 21:01:48 +0000 |
1345 | @@ -135,7 +135,7 @@ |
1346 | out, err = self.run_bzr('push --no-tree -d push-from push-to') |
1347 | self.assertEqual('', out) |
1348 | self.assertEqual('Created new branch.\n', err) |
1349 | - self.failIfExists('push-to/file') |
1350 | + self.assertPathDoesNotExist('push-to/file') |
1351 | |
1352 | def test_push_new_branch_revision_count(self): |
1353 | # bzr push of a branch with revisions to a new location |
1354 | @@ -199,10 +199,26 @@ |
1355 | t.commit(allow_pointless=True, |
1356 | message='first commit') |
1357 | self.run_bzr('push -d from to-one') |
1358 | - self.failUnlessExists('to-one') |
1359 | + self.assertPathExists('to-one') |
1360 | self.run_bzr('push -d %s %s' |
1361 | % tuple(map(urlutils.local_path_to_url, ['from', 'to-two']))) |
1362 | - self.failUnlessExists('to-two') |
1363 | + self.assertPathExists('to-two') |
1364 | + |
1365 | + def test_push_repository_no_branch_doesnt_fetch_all_revs(self): |
1366 | + # See https://bugs.launchpad.net/bzr/+bug/465517 |
1367 | + target_repo = self.make_repository('target') |
1368 | + source = self.make_branch_builder('source') |
1369 | + source.start_series() |
1370 | + source.build_snapshot('A', None, [ |
1371 | + ('add', ('', 'root-id', 'directory', None))]) |
1372 | + source.build_snapshot('B', ['A'], []) |
1373 | + source.build_snapshot('C', ['A'], []) |
1374 | + source.finish_series() |
1375 | + self.run_bzr('push target -d source') |
1376 | + self.addCleanup(target_repo.lock_read().unlock) |
1377 | + # We should have pushed 'C', but not 'B', since it isn't in the |
1378 | + # ancestry |
1379 | + self.assertEqual([('A',), ('C',)], sorted(target_repo.revisions.keys())) |
1380 | |
1381 | def test_push_smart_non_stacked_streaming_acceptance(self): |
1382 | self.setup_smart_server_with_call_log() |
1383 | @@ -308,7 +324,7 @@ |
1384 | working_dir='tree') |
1385 | new_tree = workingtree.WorkingTree.open('new/tree') |
1386 | self.assertEqual(tree.last_revision(), new_tree.last_revision()) |
1387 | - self.failUnlessExists('new/tree/a') |
1388 | + self.assertPathExists('new/tree/a') |
1389 | |
1390 | def test_push_use_existing(self): |
1391 | """'bzr push --use-existing-dir' can push into an existing dir. |
1392 | @@ -329,7 +345,7 @@ |
1393 | new_tree = workingtree.WorkingTree.open('target') |
1394 | self.assertEqual(tree.last_revision(), new_tree.last_revision()) |
1395 | # The push should have created target/a |
1396 | - self.failUnlessExists('target/a') |
1397 | + self.assertPathExists('target/a') |
1398 | |
1399 | def test_push_use_existing_into_empty_bzrdir(self): |
1400 | """'bzr push --use-existing-dir' into a dir with an empty .bzr dir |
1401 | |
1402 | === modified file 'bzrlib/tests/blackbox/test_reconfigure.py' |
1403 | --- bzrlib/tests/blackbox/test_reconfigure.py 2010-09-20 11:30:28 +0000 |
1404 | +++ bzrlib/tests/blackbox/test_reconfigure.py 2011-07-14 21:01:48 +0000 |
1405 | @@ -131,7 +131,7 @@ |
1406 | tree.add('foo') |
1407 | self.run_bzr('reconfigure --with-no-trees --force', |
1408 | working_dir='repo/branch') |
1409 | - self.failUnlessExists('repo/branch/foo') |
1410 | + self.assertPathExists('repo/branch/foo') |
1411 | tree = workingtree.WorkingTree.open('repo/branch') |
1412 | |
1413 | def test_shared_format_to_standalone(self, format=None): |
1414 | |
1415 | === modified file 'bzrlib/tests/blackbox/test_remerge.py' |
1416 | --- bzrlib/tests/blackbox/test_remerge.py 2010-09-20 11:30:28 +0000 |
1417 | +++ bzrlib/tests/blackbox/test_remerge.py 2011-07-14 21:01:48 +0000 |
1418 | @@ -74,8 +74,8 @@ |
1419 | 'remerge hello --merge-type weave', |
1420 | retcode=1) |
1421 | |
1422 | - self.failUnlessExists('hello.OTHER') |
1423 | - self.failIfExists('question.OTHER') |
1424 | + self.assertPathExists('hello.OTHER') |
1425 | + self.assertPathDoesNotExist('question.OTHER') |
1426 | |
1427 | file_id = self.run_bzr('file-id hello')[0] |
1428 | self.run_bzr_error(['hello.THIS is not versioned'], |
1429 | @@ -84,8 +84,8 @@ |
1430 | self.run_bzr_error(['conflicts encountered'], |
1431 | 'remerge --merge-type weave', retcode=1) |
1432 | |
1433 | - self.failUnlessExists('hello.OTHER') |
1434 | - self.failUnless('hello.BASE') |
1435 | + self.assertPathExists('hello.OTHER') |
1436 | + self.assertTrue('hello.BASE') |
1437 | self.assertFalse('|||||||' in conflict_text) |
1438 | self.assertFalse('hi world' in conflict_text) |
1439 | |
1440 | |
1441 | === modified file 'bzrlib/tests/blackbox/test_remove.py' |
1442 | --- bzrlib/tests/blackbox/test_remove.py 2010-10-11 02:21:33 +0000 |
1443 | +++ bzrlib/tests/blackbox/test_remove.py 2011-07-14 21:01:48 +0000 |
1444 | @@ -53,12 +53,12 @@ |
1445 | for f in files: |
1446 | id=f+_id |
1447 | self.assertNotInWorkingTree(f) |
1448 | - self.failIfExists(f) |
1449 | + self.assertPathDoesNotExist(f) |
1450 | |
1451 | def assertFilesUnversioned(self, files): |
1452 | for f in files: |
1453 | self.assertNotInWorkingTree(f) |
1454 | - self.failUnlessExists(f) |
1455 | + self.assertPathExists(f) |
1456 | |
1457 | def changeFile(self, file_name): |
1458 | f = file(file_name, 'ab') |
1459 | @@ -80,7 +80,7 @@ |
1460 | self.assertEqual('', err) |
1461 | self.assertEqual('', out) |
1462 | self.assertInWorkingTree('foo', tree=tree) |
1463 | - self.failUnlessExists('foo') |
1464 | + self.assertPathExists('foo') |
1465 | |
1466 | def test_remove_no_files_specified_missing_dir_and_contents(self): |
1467 | tree = self._make_tree_and_add( |
1468 | @@ -94,9 +94,9 @@ |
1469 | err) |
1470 | # non-missing paths not touched: |
1471 | self.assertInWorkingTree('foo', tree=tree) |
1472 | - self.failUnlessExists('foo') |
1473 | + self.assertPathExists('foo') |
1474 | self.assertInWorkingTree('dir', tree=tree) |
1475 | - self.failUnlessExists('dir') |
1476 | + self.assertPathExists('dir') |
1477 | # missing files unversioned |
1478 | self.assertNotInWorkingTree('dir/missing', tree=tree) |
1479 | self.assertNotInWorkingTree('dir/missing/child', tree=tree) |
1480 | @@ -120,7 +120,7 @@ |
1481 | self.assertEqual('removed bar\n', err) |
1482 | # non-missing files not touched: |
1483 | self.assertInWorkingTree('foo', tree=tree) |
1484 | - self.failUnlessExists('foo') |
1485 | + self.assertPathExists('foo') |
1486 | # missing files unversioned |
1487 | self.assertNotInWorkingTree('bar', tree=tree) |
1488 | |
1489 | @@ -135,7 +135,7 @@ |
1490 | self.assertEqual('removed linkname\n', err) |
1491 | # non-missing files not touched: |
1492 | self.assertInWorkingTree('foo', tree=tree) |
1493 | - self.failUnlessExists('foo') |
1494 | + self.assertPathExists('foo') |
1495 | # missing files unversioned |
1496 | self.assertNotInWorkingTree('linkname', tree=tree) |
1497 | |
1498 | @@ -196,7 +196,7 @@ |
1499 | self.run_bzr_remove_changed_files( |
1500 | ['../a', 'c', '.', '../d'], working_dir='b') |
1501 | self.assertNotInWorkingTree(files) |
1502 | - self.failIfExists(files) |
1503 | + self.assertPathDoesNotExist(files) |
1504 | |
1505 | def test_remove_keep_unversioned_files(self): |
1506 | self.build_tree(files) |
1507 | @@ -237,10 +237,10 @@ |
1508 | for f in my_files: |
1509 | osutils.delete_any(f) |
1510 | self.assertInWorkingTree(files) |
1511 | - self.failIfExists(files) |
1512 | + self.assertPathDoesNotExist(files) |
1513 | self.run_bzr('remove ' + ' '.join(files)) |
1514 | self.assertNotInWorkingTree(a) |
1515 | - self.failIfExists(files) |
1516 | + self.assertPathDoesNotExist(files) |
1517 | |
1518 | def test_remove_non_existing_files(self): |
1519 | tree = self._make_tree_and_add([]) |
1520 | |
1521 | === modified file 'bzrlib/tests/blackbox/test_remove_tree.py' |
1522 | --- bzrlib/tests/blackbox/test_remove_tree.py 2010-09-20 11:30:28 +0000 |
1523 | +++ bzrlib/tests/blackbox/test_remove_tree.py 2011-07-14 21:01:48 +0000 |
1524 | @@ -31,75 +31,75 @@ |
1525 | self.build_tree(['branch1/foo']) |
1526 | self.tree.add('foo') |
1527 | self.tree.commit('1') |
1528 | - self.failUnlessExists('branch1/foo') |
1529 | + self.assertPathExists('branch1/foo') |
1530 | |
1531 | # Success modes |
1532 | |
1533 | def test_remove_tree_original_branch(self): |
1534 | os.chdir('branch1') |
1535 | self.run_bzr('remove-tree') |
1536 | - self.failIfExists('foo') |
1537 | + self.assertPathDoesNotExist('foo') |
1538 | |
1539 | def test_remove_tree_original_branch_explicit(self): |
1540 | self.run_bzr('remove-tree branch1') |
1541 | - self.failIfExists('branch1/foo') |
1542 | + self.assertPathDoesNotExist('branch1/foo') |
1543 | |
1544 | def test_remove_tree_multiple_branch_explicit(self): |
1545 | self.tree.bzrdir.sprout('branch2') |
1546 | self.run_bzr('remove-tree branch1 branch2') |
1547 | - self.failIfExists('branch1/foo') |
1548 | - self.failIfExists('branch2/foo') |
1549 | + self.assertPathDoesNotExist('branch1/foo') |
1550 | + self.assertPathDoesNotExist('branch2/foo') |
1551 | |
1552 | def test_remove_tree_sprouted_branch(self): |
1553 | self.tree.bzrdir.sprout('branch2') |
1554 | - self.failUnlessExists('branch2/foo') |
1555 | + self.assertPathExists('branch2/foo') |
1556 | os.chdir('branch2') |
1557 | self.run_bzr('remove-tree') |
1558 | - self.failIfExists('foo') |
1559 | + self.assertPathDoesNotExist('foo') |
1560 | |
1561 | def test_remove_tree_sprouted_branch_explicit(self): |
1562 | self.tree.bzrdir.sprout('branch2') |
1563 | - self.failUnlessExists('branch2/foo') |
1564 | + self.assertPathExists('branch2/foo') |
1565 | self.run_bzr('remove-tree branch2') |
1566 | - self.failIfExists('branch2/foo') |
1567 | + self.assertPathDoesNotExist('branch2/foo') |
1568 | |
1569 | def test_remove_tree_checkout(self): |
1570 | self.tree.branch.create_checkout('branch2', lightweight=False) |
1571 | - self.failUnlessExists('branch2/foo') |
1572 | + self.assertPathExists('branch2/foo') |
1573 | os.chdir('branch2') |
1574 | self.run_bzr('remove-tree') |
1575 | - self.failIfExists('foo') |
1576 | + self.assertPathDoesNotExist('foo') |
1577 | os.chdir('..') |
1578 | - self.failUnlessExists('branch1/foo') |
1579 | + self.assertPathExists('branch1/foo') |
1580 | |
1581 | def test_remove_tree_checkout_explicit(self): |
1582 | self.tree.branch.create_checkout('branch2', lightweight=False) |
1583 | - self.failUnlessExists('branch2/foo') |
1584 | + self.assertPathExists('branch2/foo') |
1585 | self.run_bzr('remove-tree branch2') |
1586 | - self.failIfExists('branch2/foo') |
1587 | - self.failUnlessExists('branch1/foo') |
1588 | + self.assertPathDoesNotExist('branch2/foo') |
1589 | + self.assertPathExists('branch1/foo') |
1590 | |
1591 | # Failure modes |
1592 | |
1593 | def test_remove_tree_lightweight_checkout(self): |
1594 | self.tree.branch.create_checkout('branch2', lightweight=True) |
1595 | - self.failUnlessExists('branch2/foo') |
1596 | + self.assertPathExists('branch2/foo') |
1597 | os.chdir('branch2') |
1598 | output = self.run_bzr_error( |
1599 | ["You cannot remove the working tree from a lightweight checkout"], |
1600 | 'remove-tree', retcode=3) |
1601 | - self.failUnlessExists('foo') |
1602 | + self.assertPathExists('foo') |
1603 | os.chdir('..') |
1604 | - self.failUnlessExists('branch1/foo') |
1605 | + self.assertPathExists('branch1/foo') |
1606 | |
1607 | def test_remove_tree_lightweight_checkout_explicit(self): |
1608 | self.tree.branch.create_checkout('branch2', lightweight=True) |
1609 | - self.failUnlessExists('branch2/foo') |
1610 | + self.assertPathExists('branch2/foo') |
1611 | output = self.run_bzr_error( |
1612 | ["You cannot remove the working tree from a lightweight checkout"], |
1613 | 'remove-tree branch2', retcode=3) |
1614 | - self.failUnlessExists('branch2/foo') |
1615 | - self.failUnlessExists('branch1/foo') |
1616 | + self.assertPathExists('branch2/foo') |
1617 | + self.assertPathExists('branch1/foo') |
1618 | |
1619 | def test_remove_tree_empty_dir(self): |
1620 | os.mkdir('branch2') |
1621 | @@ -109,7 +109,7 @@ |
1622 | |
1623 | def test_remove_tree_repeatedly(self): |
1624 | self.run_bzr('remove-tree branch1') |
1625 | - self.failIfExists('branch1/foo') |
1626 | + self.assertPathDoesNotExist('branch1/foo') |
1627 | output = self.run_bzr_error(["No working tree to remove"], |
1628 | 'remove-tree branch1', retcode=3) |
1629 | |
1630 | @@ -127,19 +127,19 @@ |
1631 | self.build_tree(['branch1/bar']) |
1632 | self.tree.add('bar') |
1633 | self.run_bzr('remove-tree branch1 --force') |
1634 | - self.failIfExists('branch1/foo') |
1635 | - self.failUnlessExists('branch1/bar') |
1636 | + self.assertPathDoesNotExist('branch1/foo') |
1637 | + self.assertPathExists('branch1/bar') |
1638 | |
1639 | def test_remove_tree_pending_merges(self): |
1640 | self.run_bzr(['branch', 'branch1', 'branch2']) |
1641 | self.build_tree(['branch1/bar']) |
1642 | self.tree.add('bar') |
1643 | self.tree.commit('2') |
1644 | - self.failUnlessExists('branch1/bar') |
1645 | + self.assertPathExists('branch1/bar') |
1646 | self.run_bzr(['merge', '../branch1'], working_dir='branch2') |
1647 | - self.failUnlessExists('branch2/bar') |
1648 | + self.assertPathExists('branch2/bar') |
1649 | self.run_bzr(['revert', '.'], working_dir='branch2') |
1650 | - self.failIfExists('branch2/bar') |
1651 | + self.assertPathDoesNotExist('branch2/bar') |
1652 | output = self.run_bzr_error(["Working tree .* has uncommitted changes"], |
1653 | 'remove-tree branch2', retcode=3) |
1654 | |
1655 | @@ -148,14 +148,14 @@ |
1656 | self.build_tree(['branch1/bar']) |
1657 | self.tree.add('bar') |
1658 | self.tree.commit('2') |
1659 | - self.failUnlessExists('branch1/bar') |
1660 | + self.assertPathExists('branch1/bar') |
1661 | self.run_bzr(['merge', '../branch1'], working_dir='branch2') |
1662 | - self.failUnlessExists('branch2/bar') |
1663 | + self.assertPathExists('branch2/bar') |
1664 | self.run_bzr(['revert', '.'], working_dir='branch2') |
1665 | - self.failIfExists('branch2/bar') |
1666 | + self.assertPathDoesNotExist('branch2/bar') |
1667 | self.run_bzr('remove-tree branch2 --force') |
1668 | - self.failIfExists('branch2/foo') |
1669 | - self.failIfExists('branch2/bar') |
1670 | + self.assertPathDoesNotExist('branch2/foo') |
1671 | + self.assertPathDoesNotExist('branch2/bar') |
1672 | |
1673 | def test_remove_tree_shelved_changes(self): |
1674 | # https://bugs.launchpad.net/bzr/+bug/586639 |
1675 | |
1676 | === modified file 'bzrlib/tests/blackbox/test_revert.py' |
1677 | --- bzrlib/tests/blackbox/test_revert.py 2010-09-20 11:30:28 +0000 |
1678 | +++ bzrlib/tests/blackbox/test_revert.py 2011-07-14 21:01:48 +0000 |
1679 | @@ -93,17 +93,17 @@ |
1680 | """Test that revert DIRECTORY does what's expected""" |
1681 | self._prepare_rename_mod_tree() |
1682 | self.run_bzr('revert a') |
1683 | - self.failUnlessExists('a/b') |
1684 | - self.failUnlessExists('a/d') |
1685 | - self.failIfExists('a/g') |
1686 | + self.assertPathExists('a/b') |
1687 | + self.assertPathExists('a/d') |
1688 | + self.assertPathDoesNotExist('a/g') |
1689 | self.expectFailure( |
1690 | "j is in the delta revert applies because j was renamed too", |
1691 | - self.failUnlessExists, 'j') |
1692 | - self.failUnlessExists('h') |
1693 | + self.assertPathExists, 'j') |
1694 | + self.assertPathExists('h') |
1695 | self.run_bzr('revert f') |
1696 | - self.failIfExists('j') |
1697 | - self.failIfExists('h') |
1698 | - self.failUnlessExists('a/d/e') |
1699 | + self.assertPathDoesNotExist('j') |
1700 | + self.assertPathDoesNotExist('h') |
1701 | + self.assertPathExists('a/d/e') |
1702 | |
1703 | def test_revert_chatter(self): |
1704 | self._prepare_rename_mod_tree() |
1705 | @@ -148,7 +148,7 @@ |
1706 | self.run_bzr('commit -m f') |
1707 | os.unlink('symlink') |
1708 | self.run_bzr('revert') |
1709 | - self.failUnlessExists('symlink') |
1710 | + self.assertPathExists('symlink') |
1711 | os.unlink('symlink') |
1712 | os.symlink('a-different-path', 'symlink') |
1713 | self.run_bzr('revert') |
1714 | |
1715 | === modified file 'bzrlib/tests/blackbox/test_rmbranch.py' |
1716 | --- bzrlib/tests/blackbox/test_rmbranch.py 2010-09-20 11:30:28 +0000 |
1717 | +++ bzrlib/tests/blackbox/test_rmbranch.py 2011-07-14 21:01:48 +0000 |
1718 | @@ -42,8 +42,8 @@ |
1719 | self.run_bzr('rmbranch a') |
1720 | dir = bzrdir.BzrDir.open('a') |
1721 | self.assertFalse(dir.has_branch()) |
1722 | - self.failUnlessExists('a/hello') |
1723 | - self.failUnlessExists('a/goodbye') |
1724 | + self.assertPathExists('a/hello') |
1725 | + self.assertPathExists('a/goodbye') |
1726 | |
1727 | def test_no_branch(self): |
1728 | # No branch in the current directory. |
1729 | |
1730 | === modified file 'bzrlib/tests/blackbox/test_shared_repository.py' |
1731 | --- bzrlib/tests/blackbox/test_shared_repository.py 2011-01-21 22:08:19 +0000 |
1732 | +++ bzrlib/tests/blackbox/test_shared_repository.py 2011-07-14 21:01:48 +0000 |
1733 | @@ -88,7 +88,7 @@ |
1734 | cdir = BzrDir.open('a/c') |
1735 | cdir.open_branch() |
1736 | self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository) |
1737 | - self.failUnlessExists('a/c/hello') |
1738 | + self.assertPathExists('a/c/hello') |
1739 | cdir.open_workingtree() |
1740 | |
1741 | def test_trees_default(self): |
1742 | |
1743 | === modified file 'bzrlib/tests/blackbox/test_shelve.py' |
1744 | --- bzrlib/tests/blackbox/test_shelve.py 2010-11-05 23:21:04 +0000 |
1745 | +++ bzrlib/tests/blackbox/test_shelve.py 2011-07-14 21:01:48 +0000 |
1746 | @@ -72,7 +72,7 @@ |
1747 | self.build_tree(['file']) |
1748 | tree.add('file') |
1749 | self.run_bzr('shelve --all --destroy') |
1750 | - self.failIfExists('file') |
1751 | + self.assertPathDoesNotExist('file') |
1752 | self.assertIs(None, tree.get_shelf_manager().last_shelf()) |
1753 | |
1754 | def test_unshelve_keep(self): |
1755 | |
1756 | === modified file 'bzrlib/tests/blackbox/test_switch.py' |
1757 | --- bzrlib/tests/blackbox/test_switch.py 2010-09-20 11:30:28 +0000 |
1758 | +++ bzrlib/tests/blackbox/test_switch.py 2011-07-14 21:01:48 +0000 |
1759 | @@ -149,17 +149,17 @@ |
1760 | tree = self._create_sample_tree() |
1761 | checkout = tree.branch.create_checkout('checkout', lightweight=True) |
1762 | self.run_bzr(['switch', 'branch-1', '-r1'], working_dir='checkout') |
1763 | - self.failUnlessExists('checkout/file-1') |
1764 | - self.failIfExists('checkout/file-2') |
1765 | + self.assertPathExists('checkout/file-1') |
1766 | + self.assertPathDoesNotExist('checkout/file-2') |
1767 | |
1768 | def test_switch_only_revision(self): |
1769 | tree = self._create_sample_tree() |
1770 | checkout = tree.branch.create_checkout('checkout', lightweight=True) |
1771 | - self.failUnlessExists('checkout/file-1') |
1772 | - self.failUnlessExists('checkout/file-2') |
1773 | + self.assertPathExists('checkout/file-1') |
1774 | + self.assertPathExists('checkout/file-2') |
1775 | self.run_bzr(['switch', '-r1'], working_dir='checkout') |
1776 | - self.failUnlessExists('checkout/file-1') |
1777 | - self.failIfExists('checkout/file-2') |
1778 | + self.assertPathExists('checkout/file-1') |
1779 | + self.assertPathDoesNotExist('checkout/file-2') |
1780 | # Check that we don't accept a range |
1781 | self.run_bzr_error( |
1782 | ['bzr switch --revision takes exactly one revision identifier'], |
1783 | |
1784 | === modified file 'bzrlib/tests/blackbox/test_too_much.py' |
1785 | --- bzrlib/tests/blackbox/test_too_much.py 2011-01-21 22:08:19 +0000 |
1786 | +++ bzrlib/tests/blackbox/test_too_much.py 2011-07-14 21:01:48 +0000 |
1787 | @@ -88,7 +88,7 @@ |
1788 | self.run_bzr('commit -m f') |
1789 | os.unlink('symlink') |
1790 | self.run_bzr('revert') |
1791 | - self.failUnlessExists('symlink') |
1792 | + self.assertPathExists('symlink') |
1793 | os.unlink('symlink') |
1794 | os.symlink('a-different-path', 'symlink') |
1795 | self.run_bzr('revert') |
1796 | @@ -133,9 +133,9 @@ |
1797 | |
1798 | os.chdir('../a') |
1799 | out = self.run_bzr('pull --verbose ../b')[0] |
1800 | - self.failIfEqual(out.find('Added Revisions:'), -1) |
1801 | - self.failIfEqual(out.find('message:\n added b'), -1) |
1802 | - self.failIfEqual(out.find('added b'), -1) |
1803 | + self.assertNotEqual(out.find('Added Revisions:'), -1) |
1804 | + self.assertNotEqual(out.find('message:\n added b'), -1) |
1805 | + self.assertNotEqual(out.find('added b'), -1) |
1806 | |
1807 | # Check that --overwrite --verbose prints out the removed entries |
1808 | self.run_bzr('commit -m foo --unchanged') |
1809 | @@ -145,17 +145,17 @@ |
1810 | out = self.run_bzr('pull --overwrite --verbose ../a')[0] |
1811 | |
1812 | remove_loc = out.find('Removed Revisions:') |
1813 | - self.failIfEqual(remove_loc, -1) |
1814 | + self.assertNotEqual(remove_loc, -1) |
1815 | added_loc = out.find('Added Revisions:') |
1816 | - self.failIfEqual(added_loc, -1) |
1817 | + self.assertNotEqual(added_loc, -1) |
1818 | |
1819 | removed_message = out.find('message:\n baz') |
1820 | - self.failIfEqual(removed_message, -1) |
1821 | - self.failUnless(remove_loc < removed_message < added_loc) |
1822 | + self.assertNotEqual(removed_message, -1) |
1823 | + self.assertTrue(remove_loc < removed_message < added_loc) |
1824 | |
1825 | added_message = out.find('message:\n foo') |
1826 | - self.failIfEqual(added_message, -1) |
1827 | - self.failUnless(added_loc < added_message) |
1828 | + self.assertNotEqual(added_message, -1) |
1829 | + self.assertTrue(added_loc < added_message) |
1830 | |
1831 | def test_locations(self): |
1832 | """Using and remembering different locations""" |
1833 | |
1834 | === modified file 'bzrlib/tests/blackbox/test_update.py' |
1835 | --- bzrlib/tests/blackbox/test_update.py 2010-10-11 02:21:33 +0000 |
1836 | +++ bzrlib/tests/blackbox/test_update.py 2011-07-14 21:01:48 +0000 |
1837 | @@ -90,7 +90,7 @@ |
1838 | Updated to revision 1 of branch %s |
1839 | """ % osutils.pathjoin(self.test_dir, 'branch',), |
1840 | err) |
1841 | - self.failUnlessExists('branch/file') |
1842 | + self.assertPathExists('branch/file') |
1843 | |
1844 | def test_update_out_of_date_light_checkout(self): |
1845 | self.make_branch_and_tree('branch') |
1846 | @@ -179,9 +179,9 @@ |
1847 | """ % osutils.pathjoin(self.test_dir, 'master',), |
1848 | err) |
1849 | self.assertEqual([master_tip, child_tip], wt.get_parent_ids()) |
1850 | - self.failUnlessExists('checkout/file') |
1851 | - self.failUnlessExists('checkout/file_b') |
1852 | - self.failUnlessExists('checkout/file_c') |
1853 | + self.assertPathExists('checkout/file') |
1854 | + self.assertPathExists('checkout/file_b') |
1855 | + self.assertPathExists('checkout/file_c') |
1856 | self.assertTrue(wt.has_filename('file_c')) |
1857 | |
1858 | def test_update_with_merges(self): |
1859 | @@ -299,8 +299,8 @@ |
1860 | 2>All changes applied successfully. |
1861 | 2>Updated to revision 1 of .../master |
1862 | ''') |
1863 | - self.failUnlessExists('./file1') |
1864 | - self.failIfExists('./file2') |
1865 | + self.assertPathExists('./file1') |
1866 | + self.assertPathDoesNotExist('./file2') |
1867 | self.assertEquals(['m1'], master.get_parent_ids()) |
1868 | |
1869 | def test_update_dash_r_outside_history(self): |
1870 | |
1871 | === modified file 'bzrlib/tests/blackbox/test_version.py' |
1872 | --- bzrlib/tests/blackbox/test_version.py 2011-01-21 22:08:19 +0000 |
1873 | +++ bzrlib/tests/blackbox/test_version.py 2011-07-14 21:01:48 +0000 |
1874 | @@ -108,12 +108,12 @@ |
1875 | bzr_log = 'my.bzr.log' |
1876 | self.overrideEnv('BZR_LOG', bzr_log) |
1877 | default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log') |
1878 | - self.failIfExists([default_log, bzr_log]) |
1879 | + self.assertPathDoesNotExist([default_log, bzr_log]) |
1880 | out = self.run_bzr_subprocess('version')[0] |
1881 | self.assertTrue(len(out) > 0) |
1882 | self.assertContainsRe(out, r"(?m)^ Bazaar log file: " + bzr_log) |
1883 | - self.failIfExists(default_log) |
1884 | - self.failUnlessExists(bzr_log) |
1885 | + self.assertPathDoesNotExist(default_log) |
1886 | + self.assertPathExists(bzr_log) |
1887 | |
1888 | def test_dev_null(self): |
1889 | # This test uses a subprocess to cause the log opening logic to |
1890 | @@ -124,8 +124,8 @@ |
1891 | bzr_log = '/dev/null' |
1892 | self.overrideEnv('BZR_LOG', bzr_log) |
1893 | default_log = os.path.join(os.environ['BZR_HOME'], '.bzr.log') |
1894 | - self.failIfExists(default_log) |
1895 | + self.assertPathDoesNotExist(default_log) |
1896 | out = self.run_bzr_subprocess('version')[0] |
1897 | self.assertTrue(len(out) > 0) |
1898 | self.assertContainsRe(out, r"(?m)^ Bazaar log file: " + bzr_log) |
1899 | - self.failIfExists(default_log) |
1900 | + self.assertPathDoesNotExist(default_log) |
1901 | |
1902 | === modified file 'bzrlib/tests/blackbox/test_versioning.py' |
1903 | --- bzrlib/tests/blackbox/test_versioning.py 2010-09-20 11:30:28 +0000 |
1904 | +++ bzrlib/tests/blackbox/test_versioning.py 2011-07-14 21:01:48 +0000 |
1905 | @@ -39,7 +39,7 @@ |
1906 | # here locally. |
1907 | shared_repo = self.make_repository('.') |
1908 | self.run_bzr(['mkdir', 'abc'], retcode=3) |
1909 | - self.failIfExists('abc') |
1910 | + self.assertPathDoesNotExist('abc') |
1911 | |
1912 | |
1913 | class TestVersioning(TestCaseInTempDir): |
1914 | @@ -61,7 +61,7 @@ |
1915 | |
1916 | self.assertEquals(len(delta.added), 1) |
1917 | self.assertEquals(delta.added[0][0], 'foo') |
1918 | - self.failIf(delta.modified) |
1919 | + self.assertFalse(delta.modified) |
1920 | |
1921 | def test_mkdir_in_subdir(self): |
1922 | """'bzr mkdir' operation in subdirectory""" |
1923 | @@ -85,7 +85,7 @@ |
1924 | self.assertEquals(len(delta.added), 2) |
1925 | self.assertEquals(delta.added[0][0], 'dir') |
1926 | self.assertEquals(delta.added[1][0], pathjoin('dir','subdir')) |
1927 | - self.failIf(delta.modified) |
1928 | + self.assertFalse(delta.modified) |
1929 | |
1930 | def test_mkdir_w_nested_trees(self): |
1931 | """'bzr mkdir' with nested trees""" |
1932 | @@ -100,9 +100,9 @@ |
1933 | os.chdir('../..') |
1934 | |
1935 | self.run_bzr(['mkdir', 'dir', 'a/dir', 'a/b/dir']) |
1936 | - self.failUnless(os.path.isdir('dir')) |
1937 | - self.failUnless(os.path.isdir('a/dir')) |
1938 | - self.failUnless(os.path.isdir('a/b/dir')) |
1939 | + self.assertTrue(os.path.isdir('dir')) |
1940 | + self.assertTrue(os.path.isdir('a/dir')) |
1941 | + self.assertTrue(os.path.isdir('a/b/dir')) |
1942 | |
1943 | wt = WorkingTree.open('.') |
1944 | wt_a = WorkingTree.open('a') |
1945 | @@ -111,17 +111,17 @@ |
1946 | delta = wt.changes_from(wt.basis_tree()) |
1947 | self.assertEquals(len(delta.added), 1) |
1948 | self.assertEquals(delta.added[0][0], 'dir') |
1949 | - self.failIf(delta.modified) |
1950 | + self.assertFalse(delta.modified) |
1951 | |
1952 | delta = wt_a.changes_from(wt_a.basis_tree()) |
1953 | self.assertEquals(len(delta.added), 1) |
1954 | self.assertEquals(delta.added[0][0], 'dir') |
1955 | - self.failIf(delta.modified) |
1956 | + self.assertFalse(delta.modified) |
1957 | |
1958 | delta = wt_b.changes_from(wt_b.basis_tree()) |
1959 | self.assertEquals(len(delta.added), 1) |
1960 | self.assertEquals(delta.added[0][0], 'dir') |
1961 | - self.failIf(delta.modified) |
1962 | + self.assertFalse(delta.modified) |
1963 | |
1964 | def check_branch(self): |
1965 | """After all the above changes, run the check and upgrade commands. |
1966 | |
1967 | === modified file 'bzrlib/tests/blackbox/test_whoami.py' |
1968 | --- bzrlib/tests/blackbox/test_whoami.py 2011-01-21 22:08:19 +0000 |
1969 | +++ bzrlib/tests/blackbox/test_whoami.py 2011-07-14 21:01:48 +0000 |
1970 | @@ -92,10 +92,13 @@ |
1971 | 'recommended.\n', display) |
1972 | |
1973 | def test_whoami_not_set(self): |
1974 | - """Ensure whoami error if username is not set. |
1975 | + """Ensure whoami error if username is not set and not inferred. |
1976 | """ |
1977 | self.overrideEnv('EMAIL', None) |
1978 | self.overrideEnv('BZR_EMAIL', None) |
1979 | + # Also, make sure that it's not inferred from mailname. |
1980 | + self.overrideAttr(config, '_auto_user_id', |
1981 | + lambda: (None, None)) |
1982 | out, err = self.run_bzr(['whoami'], 3) |
1983 | self.assertContainsRe(err, 'Unable to determine your name') |
1984 | |
1985 | |
1986 | === modified file 'bzrlib/tests/doc_generate/builders/test_texinfo.py' |
1987 | --- bzrlib/tests/doc_generate/builders/test_texinfo.py 2011-01-21 22:08:19 +0000 |
1988 | +++ bzrlib/tests/doc_generate/builders/test_texinfo.py 2011-07-14 21:01:48 +0000 |
1989 | @@ -69,5 +69,5 @@ |
1990 | ]) |
1991 | app, out, err = self.make_sphinx() |
1992 | self.build(app) |
1993 | - self.failUnlessExists('index.texi') |
1994 | - self.failUnlessExists('content.texi') |
1995 | + self.assertPathExists('index.texi') |
1996 | + self.assertPathExists('content.texi') |
1997 | |
1998 | === modified file 'bzrlib/tests/features.py' |
1999 | --- bzrlib/tests/features.py 2011-01-21 22:08:19 +0000 |
2000 | +++ bzrlib/tests/features.py 2011-07-14 21:01:48 +0000 |
2001 | @@ -18,6 +18,7 @@ |
2002 | |
2003 | import os |
2004 | import stat |
2005 | +import sys |
2006 | |
2007 | from bzrlib import tests |
2008 | |
2009 | @@ -131,3 +132,17 @@ |
2010 | bash_feature = ExecutableFeature('bash') |
2011 | sed_feature = ExecutableFeature('sed') |
2012 | diff_feature = ExecutableFeature('diff') |
2013 | + |
2014 | + |
2015 | +class Win32Feature(tests.Feature): |
2016 | + """Feature testing whether we're running selftest on Windows |
2017 | + or Windows-like platform. |
2018 | + """ |
2019 | + |
2020 | + def _probe(self): |
2021 | + return sys.platform == 'win32' |
2022 | + |
2023 | + def feature_name(self): |
2024 | + return "win32 platform" |
2025 | + |
2026 | +win32_feature = Win32Feature() |
2027 | |
2028 | === modified file 'bzrlib/tests/per_branch/test_bound_sftp.py' |
2029 | --- bzrlib/tests/per_branch/test_bound_sftp.py 2011-02-03 18:58:06 +0000 |
2030 | +++ bzrlib/tests/per_branch/test_bound_sftp.py 2011-07-14 21:01:48 +0000 |
2031 | @@ -94,8 +94,8 @@ |
2032 | # this line is more of a working tree test line, but - what the hey, |
2033 | # it has work to do. |
2034 | b_child.bzrdir.open_workingtree().update() |
2035 | - self.failUnlessExists('child/a') |
2036 | - self.failUnlessExists('child/b') |
2037 | + self.assertPathExists('child/a') |
2038 | + self.assertPathExists('child/b') |
2039 | |
2040 | b_child.unbind() |
2041 | self.assertEqual(None, b_child.get_bound_location()) |
2042 | @@ -292,22 +292,22 @@ |
2043 | wt_other.add('c') |
2044 | wt_other.commit('adding c', rev_id='r@d-2') |
2045 | |
2046 | - self.failIf(wt_child.branch.repository.has_revision('r@d-2')) |
2047 | - self.failIf(b_base.repository.has_revision('r@d-2')) |
2048 | + self.assertFalse(wt_child.branch.repository.has_revision('r@d-2')) |
2049 | + self.assertFalse(b_base.repository.has_revision('r@d-2')) |
2050 | |
2051 | wt_child.merge_from_branch(wt_other.branch) |
2052 | |
2053 | - self.failUnlessExists('child/c') |
2054 | + self.assertPathExists('child/c') |
2055 | self.assertEqual(['r@d-2'], wt_child.get_parent_ids()[1:]) |
2056 | - self.failUnless(wt_child.branch.repository.has_revision('r@d-2')) |
2057 | - self.failIf(b_base.repository.has_revision('r@d-2')) |
2058 | + self.assertTrue(wt_child.branch.repository.has_revision('r@d-2')) |
2059 | + self.assertFalse(b_base.repository.has_revision('r@d-2')) |
2060 | |
2061 | # Commit should succeed, and cause merged revisions to |
2062 | # be pushed into base |
2063 | wt_child.commit('merge other', rev_id='r@c-2') |
2064 | self.assertEqual(['r@b-1', 'r@c-2'], wt_child.branch.revision_history()) |
2065 | self.assertEqual(['r@b-1', 'r@c-2'], b_base.revision_history()) |
2066 | - self.failUnless(b_base.repository.has_revision('r@d-2')) |
2067 | + self.assertTrue(b_base.repository.has_revision('r@d-2')) |
2068 | |
2069 | def test_commit_fails(self): |
2070 | b_base, wt_child = self.create_branches() |
2071 | |
2072 | === modified file 'bzrlib/tests/per_branch/test_branch.py' |
2073 | --- bzrlib/tests/per_branch/test_branch.py 2011-02-03 18:58:06 +0000 |
2074 | +++ bzrlib/tests/per_branch/test_branch.py 2011-07-14 21:01:48 +0000 |
2075 | @@ -360,7 +360,7 @@ |
2076 | # config file in the branch. |
2077 | branch.nick = "Aaron's branch" |
2078 | if not isinstance(branch, remote.RemoteBranch): |
2079 | - self.failUnless(branch._transport.has("branch.conf")) |
2080 | + self.assertTrue(branch._transport.has("branch.conf")) |
2081 | # Because the nick has been set explicitly, the nick is now always |
2082 | # "Aaron's branch", regardless of directory name. |
2083 | self.assertEqual(branch.nick, "Aaron's branch") |
2084 | @@ -419,7 +419,7 @@ |
2085 | def test_format_description(self): |
2086 | tree = self.make_branch_and_tree('tree') |
2087 | text = tree.branch._format.get_format_description() |
2088 | - self.failUnless(len(text)) |
2089 | + self.assertTrue(len(text)) |
2090 | |
2091 | def test_get_commit_builder(self): |
2092 | branch = self.make_branch(".") |
2093 | @@ -685,19 +685,19 @@ |
2094 | t = self.get_transport() |
2095 | readonly_t = transport.get_transport(self.get_readonly_url()) |
2096 | made_branch = self.make_branch('.') |
2097 | - self.failUnless(isinstance(made_branch, _mod_branch.Branch)) |
2098 | + self.assertIsInstance(made_branch, _mod_branch.Branch) |
2099 | |
2100 | # find it via bzrdir opening: |
2101 | opened_control = bzrdir.BzrDir.open(readonly_t.base) |
2102 | direct_opened_branch = opened_control.open_branch() |
2103 | self.assertEqual(direct_opened_branch.__class__, made_branch.__class__) |
2104 | self.assertEqual(opened_control, direct_opened_branch.bzrdir) |
2105 | - self.failUnless(isinstance(direct_opened_branch._format, |
2106 | - self.branch_format.__class__)) |
2107 | + self.assertIsInstance(direct_opened_branch._format, |
2108 | + self.branch_format.__class__) |
2109 | |
2110 | # find it via Branch.open |
2111 | opened_branch = _mod_branch.Branch.open(readonly_t.base) |
2112 | - self.failUnless(isinstance(opened_branch, made_branch.__class__)) |
2113 | + self.assertIsInstance(opened_branch, made_branch.__class__) |
2114 | self.assertEqual(made_branch._format.__class__, |
2115 | opened_branch._format.__class__) |
2116 | # if it has a unique id string, can we probe for it ? |
2117 | @@ -746,6 +746,66 @@ |
2118 | except errors.UpgradeRequired: |
2119 | raise tests.TestNotApplicable('Format does not support binding') |
2120 | |
2121 | + def test_unbind_clears_cached_master_branch(self): |
2122 | + """b.unbind clears any cached value of b.get_master_branch.""" |
2123 | + master = self.make_branch('master') |
2124 | + branch = self.make_branch('branch') |
2125 | + try: |
2126 | + branch.bind(master) |
2127 | + except errors.UpgradeRequired: |
2128 | + raise tests.TestNotApplicable('Format does not support binding') |
2129 | + self.addCleanup(branch.lock_write().unlock) |
2130 | + self.assertNotEqual(None, branch.get_master_branch()) |
2131 | + branch.unbind() |
2132 | + self.assertEqual(None, branch.get_master_branch()) |
2133 | + |
2134 | + def test_unlocked_does_not_cache_master_branch(self): |
2135 | + """Unlocked branches do not cache the result of get_master_branch.""" |
2136 | + master = self.make_branch('master') |
2137 | + branch1 = self.make_branch('branch') |
2138 | + try: |
2139 | + branch1.bind(master) |
2140 | + except errors.UpgradeRequired: |
2141 | + raise tests.TestNotApplicable('Format does not support binding') |
2142 | + # Open branch1 again |
2143 | + branch2 = branch1.bzrdir.open_branch() |
2144 | + self.assertNotEqual(None, branch1.get_master_branch()) |
2145 | + # Unbind the branch via branch2. branch1 isn't locked so will |
2146 | + # immediately return the new value for get_master_branch. |
2147 | + branch2.unbind() |
2148 | + self.assertEqual(None, branch1.get_master_branch()) |
2149 | + |
2150 | + def test_bind_clears_cached_master_branch(self): |
2151 | + """b.bind clears any cached value of b.get_master_branch.""" |
2152 | + master1 = self.make_branch('master1') |
2153 | + master2 = self.make_branch('master2') |
2154 | + branch = self.make_branch('branch') |
2155 | + try: |
2156 | + branch.bind(master1) |
2157 | + except errors.UpgradeRequired: |
2158 | + raise tests.TestNotApplicable('Format does not support binding') |
2159 | + self.addCleanup(branch.lock_write().unlock) |
2160 | + self.assertNotEqual(None, branch.get_master_branch()) |
2161 | + branch.bind(master2) |
2162 | + self.assertEqual('.', urlutils.relative_url(self.get_url('master2'), |
2163 | + branch.get_master_branch().base)) |
2164 | + |
2165 | + def test_set_bound_location_clears_cached_master_branch(self): |
2166 | + """b.set_bound_location clears any cached value of b.get_master_branch. |
2167 | + """ |
2168 | + master1 = self.make_branch('master1') |
2169 | + master2 = self.make_branch('master2') |
2170 | + branch = self.make_branch('branch') |
2171 | + try: |
2172 | + branch.bind(master1) |
2173 | + except errors.UpgradeRequired: |
2174 | + raise tests.TestNotApplicable('Format does not support binding') |
2175 | + self.addCleanup(branch.lock_write().unlock) |
2176 | + self.assertNotEqual(None, branch.get_master_branch()) |
2177 | + branch.set_bound_location(self.get_url('master2')) |
2178 | + self.assertEqual('.', urlutils.relative_url(self.get_url('master2'), |
2179 | + branch.get_master_branch().base)) |
2180 | + |
2181 | |
2182 | class TestStrict(per_branch.TestCaseWithBranch): |
2183 | |
2184 | |
2185 | === modified file 'bzrlib/tests/per_branch/test_create_checkout.py' |
2186 | --- bzrlib/tests/per_branch/test_create_checkout.py 2010-09-20 11:30:28 +0000 |
2187 | +++ bzrlib/tests/per_branch/test_create_checkout.py 2011-07-14 21:01:48 +0000 |
2188 | @@ -46,8 +46,8 @@ |
2189 | |
2190 | tree2 = tree1.branch.create_checkout('checkout', revision_id='rev-1') |
2191 | self.assertEqual('rev-1', tree2.last_revision()) |
2192 | - self.failUnlessExists('checkout/a') |
2193 | - self.failIfExists('checkout/b') |
2194 | + self.assertPathExists('checkout/a') |
2195 | + self.assertPathDoesNotExist('checkout/b') |
2196 | |
2197 | def test_create_lightweight_checkout(self): |
2198 | """We should be able to make a lightweight checkout.""" |
2199 | |
2200 | === modified file 'bzrlib/tests/per_branch/test_push.py' |
2201 | --- bzrlib/tests/per_branch/test_push.py 2011-01-21 22:08:19 +0000 |
2202 | +++ bzrlib/tests/per_branch/test_push.py 2011-07-14 21:01:48 +0000 |
2203 | @@ -1,4 +1,4 @@ |
2204 | -# Copyright (C) 2007-2010 Canonical Ltd |
2205 | +# Copyright (C) 2007-2011 Canonical Ltd |
2206 | # |
2207 | # This program is free software; you can redistribute it and/or modify |
2208 | # it under the terms of the GNU General Public License as published by |
2209 | @@ -114,6 +114,23 @@ |
2210 | self.assertRaises(errors.BoundBranchConnectionFailure, |
2211 | other.branch.push, checkout.branch) |
2212 | |
2213 | + def test_push_new_tag_to_bound_branch(self): |
2214 | + master = self.make_branch('master') |
2215 | + bound = self.make_branch('bound') |
2216 | + try: |
2217 | + bound.bind(master) |
2218 | + except errors.UpgradeRequired: |
2219 | + raise tests.TestNotApplicable( |
2220 | + 'Format does not support bound branches') |
2221 | + other = bound.bzrdir.sprout('other').open_branch() |
2222 | + try: |
2223 | + other.tags.set_tag('new-tag', 'some-rev') |
2224 | + except errors.TagsNotSupported: |
2225 | + raise tests.TestNotApplicable('Format does not support tags') |
2226 | + other.push(bound) |
2227 | + self.assertEqual({'new-tag': 'some-rev'}, bound.tags.get_tag_dict()) |
2228 | + self.assertEqual({'new-tag': 'some-rev'}, master.tags.get_tag_dict()) |
2229 | + |
2230 | def test_push_uses_read_lock(self): |
2231 | """Push should only need a read lock on the source side.""" |
2232 | source = self.make_branch_and_tree('source') |
2233 | @@ -170,6 +187,41 @@ |
2234 | self.assertEqual(tree.branch.last_revision(), |
2235 | to_branch.last_revision()) |
2236 | |
2237 | + def test_push_repository_no_branch_doesnt_fetch_all_revs(self): |
2238 | + # See https://bugs.launchpad.net/bzr/+bug/465517 |
2239 | + t = self.get_transport('target') |
2240 | + t.ensure_base() |
2241 | + bzrdir = self.bzrdir_format.initialize_on_transport(t) |
2242 | + try: |
2243 | + bzrdir.open_branch() |
2244 | + except errors.NotBranchError: |
2245 | + pass |
2246 | + else: |
2247 | + raise tests.TestNotApplicable('older formats can\'t have a repo' |
2248 | + ' without a branch') |
2249 | + try: |
2250 | + source = self.make_branch_builder('source', |
2251 | + format=self.bzrdir_format) |
2252 | + except errors.UninitializableFormat: |
2253 | + raise tests.TestNotApplicable('cannot initialize this format') |
2254 | + source.start_series() |
2255 | + source.build_snapshot('A', None, [ |
2256 | + ('add', ('', 'root-id', 'directory', None))]) |
2257 | + source.build_snapshot('B', ['A'], []) |
2258 | + source.build_snapshot('C', ['A'], []) |
2259 | + source.finish_series() |
2260 | + b = source.get_branch() |
2261 | + # Note: We can't read lock the source branch. Some formats take a write |
2262 | + # lock to 'set_push_location', which breaks |
2263 | + self.addCleanup(b.lock_write().unlock) |
2264 | + repo = bzrdir.create_repository() |
2265 | + # This means 'push the source branch into this dir' |
2266 | + bzrdir.push_branch(b) |
2267 | + self.addCleanup(repo.lock_read().unlock) |
2268 | + # We should have pushed 'C', but not 'B', since it isn't in the |
2269 | + # ancestry |
2270 | + self.assertEqual([('A',), ('C',)], sorted(repo.revisions.keys())) |
2271 | + |
2272 | def test_push_overwrite_of_non_tip_with_stop_revision(self): |
2273 | """Combining the stop_revision and overwrite options works. |
2274 | |
2275 | |
2276 | === modified file 'bzrlib/tests/per_branch/test_sprout.py' |
2277 | --- bzrlib/tests/per_branch/test_sprout.py 2011-01-21 22:08:19 +0000 |
2278 | +++ bzrlib/tests/per_branch/test_sprout.py 2011-07-14 21:01:48 +0000 |
2279 | @@ -125,7 +125,7 @@ |
2280 | wt2 = wt.bzrdir.sprout('target', |
2281 | revision_id='rev1a').open_workingtree() |
2282 | self.assertEqual('rev1a', wt2.last_revision()) |
2283 | - self.failUnlessExists('target/a') |
2284 | + self.assertPathExists('target/a') |
2285 | |
2286 | def test_sprout_with_unicode_symlink(self): |
2287 | # this tests bug #272444 |
2288 | |
2289 | === modified file 'bzrlib/tests/per_bzrdir/test_bzrdir.py' |
2290 | --- bzrlib/tests/per_bzrdir/test_bzrdir.py 2010-10-11 02:21:33 +0000 |
2291 | +++ bzrlib/tests/per_bzrdir/test_bzrdir.py 2011-07-14 21:01:48 +0000 |
2292 | @@ -476,10 +476,10 @@ |
2293 | # must not overwrite existing directories |
2294 | self.build_tree(['.bzr.retired.0/', '.bzr.retired.0/junk',], |
2295 | transport=transport) |
2296 | - self.failUnless(transport.has('.bzr')) |
2297 | + self.assertTrue(transport.has('.bzr')) |
2298 | bd.retire_bzrdir() |
2299 | - self.failIf(transport.has('.bzr')) |
2300 | - self.failUnless(transport.has('.bzr.retired.1')) |
2301 | + self.assertFalse(transport.has('.bzr')) |
2302 | + self.assertTrue(transport.has('.bzr.retired.1')) |
2303 | |
2304 | def test_retire_bzrdir_limited(self): |
2305 | bd = self.make_bzrdir('.') |
2306 | @@ -487,6 +487,6 @@ |
2307 | # must not overwrite existing directories |
2308 | self.build_tree(['.bzr.retired.0/', '.bzr.retired.0/junk',], |
2309 | transport=transport) |
2310 | - self.failUnless(transport.has('.bzr')) |
2311 | + self.assertTrue(transport.has('.bzr')) |
2312 | self.assertRaises((errors.FileExists, errors.DirectoryNotEmpty), |
2313 | bd.retire_bzrdir, limit=0) |
2314 | |
2315 | === modified file 'bzrlib/tests/per_controldir/test_controldir.py' |
2316 | --- bzrlib/tests/per_controldir/test_controldir.py 2011-02-03 18:58:06 +0000 |
2317 | +++ bzrlib/tests/per_controldir/test_controldir.py 2011-07-14 21:01:48 +0000 |
2318 | @@ -121,12 +121,12 @@ |
2319 | bzrdir.destroy_workingtree() |
2320 | except errors.UnsupportedOperation: |
2321 | raise TestSkipped('Format does not support destroying tree') |
2322 | - self.failIfExists('tree/file') |
2323 | + self.assertPathDoesNotExist('tree/file') |
2324 | self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree) |
2325 | bzrdir.create_workingtree() |
2326 | - self.failUnlessExists('tree/file') |
2327 | + self.assertPathExists('tree/file') |
2328 | bzrdir.destroy_workingtree_metadata() |
2329 | - self.failUnlessExists('tree/file') |
2330 | + self.assertPathExists('tree/file') |
2331 | self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree) |
2332 | |
2333 | def test_destroy_branch(self): |
2334 | @@ -762,7 +762,7 @@ |
2335 | create_tree_if_local=False) |
2336 | except errors.MustHaveWorkingTree: |
2337 | raise TestNotApplicable("control dir format requires working tree") |
2338 | - self.failIfExists('target/foo') |
2339 | + self.assertPathDoesNotExist('target/foo') |
2340 | self.assertEqual(tree.branch.last_revision(), |
2341 | target.open_branch().last_revision()) |
2342 | |
2343 | @@ -807,7 +807,7 @@ |
2344 | t = self.get_transport() |
2345 | readonly_t = self.get_readonly_transport() |
2346 | made_control = self.bzrdir_format.initialize(t.base) |
2347 | - self.failUnless(isinstance(made_control, controldir.ControlDir)) |
2348 | + self.assertIsInstance(made_control, controldir.ControlDir) |
2349 | self.assertEqual(self.bzrdir_format, |
2350 | controldir.ControlDirFormat.find_format(readonly_t)) |
2351 | direct_opened_dir = self.bzrdir_format.open(readonly_t) |
2352 | @@ -816,7 +816,7 @@ |
2353 | opened_dir._format) |
2354 | self.assertEqual(direct_opened_dir._format, |
2355 | opened_dir._format) |
2356 | - self.failUnless(isinstance(opened_dir, controldir.ControlDir)) |
2357 | + self.assertIsInstance(opened_dir, controldir.ControlDir) |
2358 | |
2359 | def test_format_initialize_on_transport_ex(self): |
2360 | t = self.get_transport('dir') |
2361 | @@ -1029,7 +1029,7 @@ |
2362 | made_control = self.bzrdir_format.initialize(t.base) |
2363 | made_repo = made_control.create_repository() |
2364 | made_branch = made_control.create_branch() |
2365 | - self.failUnless(isinstance(made_branch, bzrlib.branch.Branch)) |
2366 | + self.assertIsInstance(made_branch, bzrlib.branch.Branch) |
2367 | self.assertEqual(made_control, made_branch.bzrdir) |
2368 | |
2369 | def test_open_branch(self): |
2370 | @@ -1044,8 +1044,8 @@ |
2371 | made_branch = made_control.create_branch() |
2372 | opened_branch = made_control.open_branch() |
2373 | self.assertEqual(made_control, opened_branch.bzrdir) |
2374 | - self.failUnless(isinstance(opened_branch, made_branch.__class__)) |
2375 | - self.failUnless(isinstance(opened_branch._format, made_branch._format.__class__)) |
2376 | + self.assertIsInstance(opened_branch, made_branch.__class__) |
2377 | + self.assertIsInstance(opened_branch._format, made_branch._format.__class__) |
2378 | |
2379 | def test_list_branches(self): |
2380 | if not self.bzrdir_format.is_supported(): |
2381 | @@ -1122,8 +1122,8 @@ |
2382 | made_repo = made_control.create_repository() |
2383 | opened_repo = made_control.open_repository() |
2384 | self.assertEqual(made_control, opened_repo.bzrdir) |
2385 | - self.failUnless(isinstance(opened_repo, made_repo.__class__)) |
2386 | - self.failUnless(isinstance(opened_repo._format, made_repo._format.__class__)) |
2387 | + self.assertIsInstance(opened_repo, made_repo.__class__) |
2388 | + self.assertIsInstance(opened_repo._format, made_repo._format.__class__) |
2389 | |
2390 | def test_create_workingtree(self): |
2391 | # a bzrdir can construct a working tree for itself. |
2392 | @@ -1137,7 +1137,7 @@ |
2393 | made_repo = made_control.create_repository() |
2394 | made_branch = made_control.create_branch() |
2395 | made_tree = self.createWorkingTreeOrSkip(made_control) |
2396 | - self.failUnless(isinstance(made_tree, workingtree.WorkingTree)) |
2397 | + self.assertIsInstance(made_tree, workingtree.WorkingTree) |
2398 | self.assertEqual(made_control, made_tree.bzrdir) |
2399 | |
2400 | def test_create_workingtree_revision(self): |
2401 | @@ -1176,8 +1176,8 @@ |
2402 | % (self.bzrdir_format, t)) |
2403 | opened_tree = made_control.open_workingtree() |
2404 | self.assertEqual(made_control, opened_tree.bzrdir) |
2405 | - self.failUnless(isinstance(opened_tree, made_tree.__class__)) |
2406 | - self.failUnless(isinstance(opened_tree._format, made_tree._format.__class__)) |
2407 | + self.assertIsInstance(opened_tree, made_tree.__class__) |
2408 | + self.assertIsInstance(opened_tree._format, made_tree._format.__class__) |
2409 | |
2410 | def test_get_branch_transport(self): |
2411 | dir = self.make_bzrdir('.') |
2412 | @@ -1379,8 +1379,8 @@ |
2413 | old_url, new_url = tree.bzrdir.backup_bzrdir() |
2414 | old_path = urlutils.local_path_from_url(old_url) |
2415 | new_path = urlutils.local_path_from_url(new_url) |
2416 | - self.failUnlessExists(old_path) |
2417 | - self.failUnlessExists(new_path) |
2418 | + self.assertPathExists(old_path) |
2419 | + self.assertPathExists(new_path) |
2420 | for (((dir_relpath1, _), entries1), |
2421 | ((dir_relpath2, _), entries2)) in izip( |
2422 | osutils.walkdirs(old_path), |
2423 | @@ -1414,7 +1414,7 @@ |
2424 | def test_format_description(self): |
2425 | dir = self.make_bzrdir('.') |
2426 | text = dir._format.get_format_description() |
2427 | - self.failUnless(len(text)) |
2428 | + self.assertTrue(len(text)) |
2429 | |
2430 | |
2431 | class TestBreakLock(TestCaseWithControlDir): |
2432 | |
2433 | === modified file 'bzrlib/tests/per_controldir_colo/test_supported.py' |
2434 | --- bzrlib/tests/per_controldir_colo/test_supported.py 2011-02-03 18:58:06 +0000 |
2435 | +++ bzrlib/tests/per_controldir_colo/test_supported.py 2011-07-14 21:01:48 +0000 |
2436 | @@ -52,5 +52,5 @@ |
2437 | 'Control dir does not support creating new branches.') |
2438 | made_repo = made_control.create_repository() |
2439 | made_branch = made_control.create_branch("colo") |
2440 | - self.failUnless(isinstance(made_branch, bzrlib.branch.Branch)) |
2441 | + self.assertIsInstance(made_branch, bzrlib.branch.Branch) |
2442 | self.assertEqual(made_control, made_branch.bzrdir) |
2443 | |
2444 | === modified file 'bzrlib/tests/per_repository/test_commit_builder.py' |
2445 | --- bzrlib/tests/per_repository/test_commit_builder.py 2011-01-21 22:08:19 +0000 |
2446 | +++ bzrlib/tests/per_repository/test_commit_builder.py 2011-07-14 21:01:48 +0000 |
2447 | @@ -19,6 +19,7 @@ |
2448 | import os |
2449 | |
2450 | from bzrlib import ( |
2451 | + config, |
2452 | errors, |
2453 | graph, |
2454 | inventory, |
2455 | @@ -1322,6 +1323,10 @@ |
2456 | # Ensure that when no username is available but a committer is |
2457 | # supplied, commit works. |
2458 | self.overrideEnv('EMAIL', None) |
2459 | + self.overrideEnv('BZR_EMAIL', None) |
2460 | + # Also, make sure that it's not inferred from mailname. |
2461 | + self.overrideAttr(config, '_auto_user_id', |
2462 | + lambda: (None, None)) |
2463 | tree = self.make_branch_and_tree(".") |
2464 | tree.lock_write() |
2465 | try: |
2466 | |
2467 | === modified file 'bzrlib/tests/per_repository/test_has_same_location.py' |
2468 | --- bzrlib/tests/per_repository/test_has_same_location.py 2010-09-20 11:30:28 +0000 |
2469 | +++ bzrlib/tests/per_repository/test_has_same_location.py 2011-07-14 21:01:48 +0000 |
2470 | @@ -64,7 +64,7 @@ |
2471 | """Different repository objects for the same location are the same.""" |
2472 | repo = self.make_repository('.') |
2473 | reopened_repo = repo.bzrdir.open_repository() |
2474 | - self.failIf( |
2475 | + self.assertFalse( |
2476 | repo is reopened_repo, |
2477 | "This test depends on reopened_repo being a different instance of " |
2478 | "the same repo.") |
2479 | |
2480 | === modified file 'bzrlib/tests/per_repository/test_repository.py' |
2481 | --- bzrlib/tests/per_repository/test_repository.py 2011-02-03 18:58:06 +0000 |
2482 | +++ bzrlib/tests/per_repository/test_repository.py 2011-07-14 21:01:48 +0000 |
2483 | @@ -295,7 +295,7 @@ |
2484 | self.repository_format.__class__) |
2485 | # find it via Repository.open |
2486 | opened_repo = repository.Repository.open(readonly_t.base) |
2487 | - self.failUnless(isinstance(opened_repo, made_repo.__class__)) |
2488 | + self.assertIsInstance(opened_repo, made_repo.__class__) |
2489 | self.assertEqual(made_repo._format.__class__, |
2490 | opened_repo._format.__class__) |
2491 | # if it has a unique id string, can we probe for it ? |
2492 | @@ -521,7 +521,7 @@ |
2493 | def test_format_description(self): |
2494 | repo = self.make_repository('.') |
2495 | text = repo._format.get_format_description() |
2496 | - self.failUnless(len(text)) |
2497 | + self.assertTrue(len(text)) |
2498 | |
2499 | def test_format_supports_external_lookups(self): |
2500 | repo = self.make_repository('.') |
2501 | |
2502 | === modified file 'bzrlib/tests/per_transport.py' |
2503 | --- bzrlib/tests/per_transport.py 2011-02-03 18:58:06 +0000 |
2504 | +++ bzrlib/tests/per_transport.py 2011-07-14 21:01:48 +0000 |
2505 | @@ -285,7 +285,7 @@ |
2506 | return |
2507 | |
2508 | t.put_bytes('a', 'some text for a\n') |
2509 | - self.failUnless(t.has('a')) |
2510 | + self.assertTrue(t.has('a')) |
2511 | self.check_transport_contents('some text for a\n', t, 'a') |
2512 | |
2513 | # The contents should be overwritten |
2514 | @@ -303,9 +303,9 @@ |
2515 | t.put_bytes_non_atomic, 'a', 'some text for a\n') |
2516 | return |
2517 | |
2518 | - self.failIf(t.has('a')) |
2519 | + self.assertFalse(t.has('a')) |
2520 | t.put_bytes_non_atomic('a', 'some text for a\n') |
2521 | - self.failUnless(t.has('a')) |
2522 | + self.assertTrue(t.has('a')) |
2523 | self.check_transport_contents('some text for a\n', t, 'a') |
2524 | # Put also replaces contents |
2525 | t.put_bytes_non_atomic('a', 'new\ncontents for\na\n') |
2526 | @@ -323,7 +323,7 @@ |
2527 | # Now test the create_parent flag |
2528 | self.assertRaises(NoSuchFile, t.put_bytes_non_atomic, 'dir/a', |
2529 | 'contents\n') |
2530 | - self.failIf(t.has('dir/a')) |
2531 | + self.assertFalse(t.has('dir/a')) |
2532 | t.put_bytes_non_atomic('dir/a', 'contents for dir/a\n', |
2533 | create_parent_dir=True) |
2534 | self.check_transport_contents('contents for dir/a\n', t, 'dir/a') |
2535 | @@ -401,7 +401,7 @@ |
2536 | result = t.put_file('a', StringIO('some text for a\n')) |
2537 | # put_file returns the length of the data written |
2538 | self.assertEqual(16, result) |
2539 | - self.failUnless(t.has('a')) |
2540 | + self.assertTrue(t.has('a')) |
2541 | self.check_transport_contents('some text for a\n', t, 'a') |
2542 | # Put also replaces contents |
2543 | result = t.put_file('a', StringIO('new\ncontents for\na\n')) |
2544 | @@ -419,9 +419,9 @@ |
2545 | t.put_file_non_atomic, 'a', StringIO('some text for a\n')) |
2546 | return |
2547 | |
2548 | - self.failIf(t.has('a')) |
2549 | + self.assertFalse(t.has('a')) |
2550 | t.put_file_non_atomic('a', StringIO('some text for a\n')) |
2551 | - self.failUnless(t.has('a')) |
2552 | + self.assertTrue(t.has('a')) |
2553 | self.check_transport_contents('some text for a\n', t, 'a') |
2554 | # Put also replaces contents |
2555 | t.put_file_non_atomic('a', StringIO('new\ncontents for\na\n')) |
2556 | @@ -439,7 +439,7 @@ |
2557 | # Now test the create_parent flag |
2558 | self.assertRaises(NoSuchFile, t.put_file_non_atomic, 'dir/a', |
2559 | StringIO('contents\n')) |
2560 | - self.failIf(t.has('dir/a')) |
2561 | + self.assertFalse(t.has('dir/a')) |
2562 | t.put_file_non_atomic('dir/a', StringIO('contents for dir/a\n'), |
2563 | create_parent_dir=True) |
2564 | self.check_transport_contents('contents for dir/a\n', t, 'dir/a') |
2565 | @@ -822,9 +822,9 @@ |
2566 | return |
2567 | |
2568 | t.put_bytes('a', 'a little bit of text\n') |
2569 | - self.failUnless(t.has('a')) |
2570 | + self.assertTrue(t.has('a')) |
2571 | t.delete('a') |
2572 | - self.failIf(t.has('a')) |
2573 | + self.assertFalse(t.has('a')) |
2574 | |
2575 | self.assertRaises(NoSuchFile, t.delete, 'a') |
2576 | |
2577 | @@ -836,9 +836,9 @@ |
2578 | t.delete_multi(['a', 'c']) |
2579 | self.assertEqual([False, True, False], |
2580 | list(t.has_multi(['a', 'b', 'c']))) |
2581 | - self.failIf(t.has('a')) |
2582 | - self.failUnless(t.has('b')) |
2583 | - self.failIf(t.has('c')) |
2584 | + self.assertFalse(t.has('a')) |
2585 | + self.assertTrue(t.has('b')) |
2586 | + self.assertFalse(t.has('c')) |
2587 | |
2588 | self.assertRaises(NoSuchFile, |
2589 | t.delete_multi, ['a', 'b', 'c']) |
2590 | @@ -905,7 +905,7 @@ |
2591 | t.mkdir('foo-baz') |
2592 | t.rmdir('foo') |
2593 | self.assertRaises((NoSuchFile, PathError), t.rmdir, 'foo') |
2594 | - self.failUnless(t.has('foo-bar')) |
2595 | + self.assertTrue(t.has('foo-bar')) |
2596 | |
2597 | def test_rename_dir_succeeds(self): |
2598 | t = self.get_transport() |
2599 | @@ -994,8 +994,8 @@ |
2600 | self.assertEquals([True, False], list(t.has_multi(['a', 'b']))) |
2601 | |
2602 | t.move('a', 'b') |
2603 | - self.failUnless(t.has('b')) |
2604 | - self.failIf(t.has('a')) |
2605 | + self.assertTrue(t.has('b')) |
2606 | + self.assertFalse(t.has('a')) |
2607 | |
2608 | self.check_transport_contents('a first file\n', t, 'b') |
2609 | self.assertEquals([False, True], list(t.has_multi(['a', 'b']))) |
2610 | @@ -1003,7 +1003,7 @@ |
2611 | # Overwrite a file |
2612 | t.put_bytes('c', 'c this file\n') |
2613 | t.move('c', 'b') |
2614 | - self.failIf(t.has('c')) |
2615 | + self.assertFalse(t.has('c')) |
2616 | self.check_transport_contents('c this file\n', t, 'b') |
2617 | |
2618 | # TODO: Try to write a test for atomicity |
2619 | @@ -1063,10 +1063,10 @@ |
2620 | for path, size in zip(paths, sizes): |
2621 | st = t.stat(path) |
2622 | if path.endswith('/'): |
2623 | - self.failUnless(S_ISDIR(st.st_mode)) |
2624 | + self.assertTrue(S_ISDIR(st.st_mode)) |
2625 | # directory sizes are meaningless |
2626 | else: |
2627 | - self.failUnless(S_ISREG(st.st_mode)) |
2628 | + self.assertTrue(S_ISREG(st.st_mode)) |
2629 | self.assertEqual(size, st.st_size) |
2630 | |
2631 | remote_stats = list(t.stat_multi(paths)) |
2632 | @@ -1095,11 +1095,11 @@ |
2633 | try: |
2634 | t.hardlink(source_name, link_name) |
2635 | |
2636 | - self.failUnless(t.has(source_name)) |
2637 | - self.failUnless(t.has(link_name)) |
2638 | + self.assertTrue(t.has(source_name)) |
2639 | + self.assertTrue(t.has(link_name)) |
2640 | |
2641 | st = t.stat(link_name) |
2642 | - self.failUnlessEqual(st[ST_NLINK], 2) |
2643 | + self.assertEqual(st[ST_NLINK], 2) |
2644 | except TransportNotPossible: |
2645 | raise TestSkipped("Transport %s does not support hardlinks." % |
2646 | self._server.__class__) |
2647 | @@ -1117,11 +1117,11 @@ |
2648 | try: |
2649 | t.symlink(source_name, link_name) |
2650 | |
2651 | - self.failUnless(t.has(source_name)) |
2652 | - self.failUnless(t.has(link_name)) |
2653 | + self.assertTrue(t.has(source_name)) |
2654 | + self.assertTrue(t.has(link_name)) |
2655 | |
2656 | st = t.stat(link_name) |
2657 | - self.failUnless(S_ISLNK(st.st_mode), |
2658 | + self.assertTrue(S_ISLNK(st.st_mode), |
2659 | "expected symlink, got mode %o" % st.st_mode) |
2660 | except TransportNotPossible: |
2661 | raise TestSkipped("Transport %s does not support symlinks." % |
2662 | @@ -1293,32 +1293,32 @@ |
2663 | |
2664 | self.build_tree(['a', 'b/', 'b/c'], transport=t1) |
2665 | |
2666 | - self.failUnless(t1.has('a')) |
2667 | - self.failUnless(t1.has('b/c')) |
2668 | - self.failIf(t1.has('c')) |
2669 | + self.assertTrue(t1.has('a')) |
2670 | + self.assertTrue(t1.has('b/c')) |
2671 | + self.assertFalse(t1.has('c')) |
2672 | |
2673 | t2 = t1.clone('b') |
2674 | self.assertEqual(t1.base + 'b/', t2.base) |
2675 | |
2676 | - self.failUnless(t2.has('c')) |
2677 | - self.failIf(t2.has('a')) |
2678 | + self.assertTrue(t2.has('c')) |
2679 | + self.assertFalse(t2.has('a')) |
2680 | |
2681 | t3 = t2.clone('..') |
2682 | - self.failUnless(t3.has('a')) |
2683 | - self.failIf(t3.has('c')) |
2684 | + self.assertTrue(t3.has('a')) |
2685 | + self.assertFalse(t3.has('c')) |
2686 | |
2687 | - self.failIf(t1.has('b/d')) |
2688 | - self.failIf(t2.has('d')) |
2689 | - self.failIf(t3.has('b/d')) |
2690 | + self.assertFalse(t1.has('b/d')) |
2691 | + self.assertFalse(t2.has('d')) |
2692 | + self.assertFalse(t3.has('b/d')) |
2693 | |
2694 | if t1.is_readonly(): |
2695 | self.build_tree_contents([('b/d', 'newfile\n')]) |
2696 | else: |
2697 | t2.put_bytes('d', 'newfile\n') |
2698 | |
2699 | - self.failUnless(t1.has('b/d')) |
2700 | - self.failUnless(t2.has('d')) |
2701 | - self.failUnless(t3.has('b/d')) |
2702 | + self.assertTrue(t1.has('b/d')) |
2703 | + self.assertTrue(t2.has('d')) |
2704 | + self.assertTrue(t3.has('b/d')) |
2705 | |
2706 | def test_clone_to_root(self): |
2707 | orig_transport = self.get_transport() |
2708 | @@ -1410,11 +1410,11 @@ |
2709 | # smoke test for abspath on win32. |
2710 | # a transport based on 'file:///' never fully qualifies the drive. |
2711 | transport = _mod_transport.get_transport("file:///") |
2712 | - self.failUnlessEqual(transport.abspath("/"), "file:///") |
2713 | + self.assertEqual(transport.abspath("/"), "file:///") |
2714 | |
2715 | # but a transport that starts with a drive spec must keep it. |
2716 | transport = _mod_transport.get_transport("file:///C:/") |
2717 | - self.failUnlessEqual(transport.abspath("/"), "file:///C:/") |
2718 | + self.assertEqual(transport.abspath("/"), "file:///C:/") |
2719 | |
2720 | def test_local_abspath(self): |
2721 | transport = self.get_transport() |
2722 | |
2723 | === modified file 'bzrlib/tests/per_tree/test_get_file_mtime.py' |
2724 | --- bzrlib/tests/per_tree/test_get_file_mtime.py 2010-09-20 11:30:28 +0000 |
2725 | +++ bzrlib/tests/per_tree/test_get_file_mtime.py 2011-07-14 21:01:48 +0000 |
2726 | @@ -38,7 +38,7 @@ |
2727 | # file, working trees return the on-disk time. |
2728 | mtime_file_id = tree.get_file_mtime(file_id='one-id') |
2729 | self.assertIsInstance(mtime_file_id, (float, int)) |
2730 | - self.failUnless(now - 5 < mtime_file_id < now + 5, |
2731 | + self.assertTrue(now - 5 < mtime_file_id < now + 5, |
2732 | 'now: %f, mtime_file_id: %f' % (now, mtime_file_id )) |
2733 | mtime_path = tree.get_file_mtime(file_id='one-id', path='one') |
2734 | self.assertEqual(mtime_file_id, mtime_path) |
2735 | |
2736 | === modified file 'bzrlib/tests/per_workingtree/test_commit.py' |
2737 | --- bzrlib/tests/per_workingtree/test_commit.py 2010-09-20 11:30:28 +0000 |
2738 | +++ bzrlib/tests/per_workingtree/test_commit.py 2011-07-14 21:01:48 +0000 |
2739 | @@ -273,7 +273,7 @@ |
2740 | # older format. |
2741 | return |
2742 | tree.commit('foo', rev_id='foo', local=True) |
2743 | - self.failIf(master.repository.has_revision('foo')) |
2744 | + self.assertFalse(master.repository.has_revision('foo')) |
2745 | self.assertEqual(_mod_revision.NULL_REVISION, |
2746 | (_mod_revision.ensure_null(master.last_revision()))) |
2747 | |
2748 | |
2749 | === modified file 'bzrlib/tests/per_workingtree/test_executable.py' |
2750 | --- bzrlib/tests/per_workingtree/test_executable.py 2009-09-10 13:48:15 +0000 |
2751 | +++ bzrlib/tests/per_workingtree/test_executable.py 2011-07-14 21:01:48 +0000 |
2752 | @@ -44,9 +44,9 @@ |
2753 | def check_exist(self, tree): |
2754 | """Just check that both files have the right executable bits set""" |
2755 | tree.lock_read() |
2756 | - self.failUnless(tree.is_executable(self.a_id), |
2757 | + self.assertTrue(tree.is_executable(self.a_id), |
2758 | "'a' lost the execute bit") |
2759 | - self.failIf(tree.is_executable(self.b_id), |
2760 | + self.assertFalse(tree.is_executable(self.b_id), |
2761 | "'b' gained an execute bit") |
2762 | tree.unlock() |
2763 | |
2764 | @@ -61,10 +61,10 @@ |
2765 | self.assertEqual( |
2766 | [('', tree.inventory.root)], |
2767 | list(tree.inventory.iter_entries())) |
2768 | - self.failIf(tree.has_id(self.a_id)) |
2769 | - self.failIf(tree.has_filename('a')) |
2770 | - self.failIf(tree.has_id(self.b_id)) |
2771 | - self.failIf(tree.has_filename('b')) |
2772 | + self.assertFalse(tree.has_id(self.a_id)) |
2773 | + self.assertFalse(tree.has_filename('a')) |
2774 | + self.assertFalse(tree.has_id(self.b_id)) |
2775 | + self.assertFalse(tree.has_filename('b')) |
2776 | tree.unlock() |
2777 | |
2778 | def commit_and_branch(self): |
2779 | |
2780 | === modified file 'bzrlib/tests/per_workingtree/test_move.py' |
2781 | --- bzrlib/tests/per_workingtree/test_move.py 2010-09-20 11:30:28 +0000 |
2782 | +++ bzrlib/tests/per_workingtree/test_move.py 2011-07-14 21:01:48 +0000 |
2783 | @@ -173,7 +173,7 @@ |
2784 | ('b/c', 'c-id')], tree) |
2785 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id'), |
2786 | ('b/c', 'c-id')], tree.basis_tree()) |
2787 | - self.failIfExists('a') |
2788 | + self.assertPathDoesNotExist('a') |
2789 | self.assertFileEqual(a_contents, 'b/a') |
2790 | tree._validate() |
2791 | |
2792 | @@ -190,7 +190,7 @@ |
2793 | ('c', 'c-id')], tree) |
2794 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id'), |
2795 | ('b/c', 'c-id')], tree.basis_tree()) |
2796 | - self.failIfExists('b/c') |
2797 | + self.assertPathDoesNotExist('b/c') |
2798 | self.assertFileEqual(c_contents, 'c') |
2799 | tree._validate() |
2800 | |
2801 | @@ -209,7 +209,7 @@ |
2802 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id'), |
2803 | ('c', 'c-id')], tree) |
2804 | else: |
2805 | - self.failUnlessExists('b/c') |
2806 | + self.assertPathExists('b/c') |
2807 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id'), |
2808 | ('b/c', 'c-id')], tree) |
2809 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id'), |
2810 | |
2811 | === modified file 'bzrlib/tests/per_workingtree/test_pull.py' |
2812 | --- bzrlib/tests/per_workingtree/test_pull.py 2010-11-05 23:21:04 +0000 |
2813 | +++ bzrlib/tests/per_workingtree/test_pull.py 2011-07-14 21:01:48 +0000 |
2814 | @@ -34,7 +34,7 @@ |
2815 | def test_pull(self): |
2816 | tree_a, tree_b = self.get_pullable_trees() |
2817 | tree_b.pull(tree_a.branch) |
2818 | - self.failUnless(tree_b.branch.repository.has_revision('A')) |
2819 | + self.assertTrue(tree_b.branch.repository.has_revision('A')) |
2820 | self.assertEqual(['A'], tree_b.get_parent_ids()) |
2821 | |
2822 | def test_pull_overwrites(self): |
2823 | @@ -42,8 +42,8 @@ |
2824 | tree_b.commit('foo', rev_id='B') |
2825 | self.assertEqual(['B'], tree_b.branch.revision_history()) |
2826 | tree_b.pull(tree_a.branch, overwrite=True) |
2827 | - self.failUnless(tree_b.branch.repository.has_revision('A')) |
2828 | - self.failUnless(tree_b.branch.repository.has_revision('B')) |
2829 | + self.assertTrue(tree_b.branch.repository.has_revision('A')) |
2830 | + self.assertTrue(tree_b.branch.repository.has_revision('B')) |
2831 | self.assertEqual(['A'], tree_b.get_parent_ids()) |
2832 | |
2833 | def test_pull_merges_tree_content(self): |
2834 | @@ -100,4 +100,4 @@ |
2835 | work.pull(trunk) |
2836 | self.assertLength(0, work.conflicts()) |
2837 | # The directory removal should succeed |
2838 | - self.failIfExists('work/dir') |
2839 | + self.assertPathDoesNotExist('work/dir') |
2840 | |
2841 | === modified file 'bzrlib/tests/per_workingtree/test_remove.py' |
2842 | --- bzrlib/tests/per_workingtree/test_remove.py 2010-09-20 11:30:28 +0000 |
2843 | +++ bzrlib/tests/per_workingtree/test_remove.py 2011-07-14 21:01:48 +0000 |
2844 | @@ -29,7 +29,7 @@ |
2845 | def get_tree(self, files): |
2846 | tree = self.make_branch_and_tree('.') |
2847 | self.build_tree(files) |
2848 | - self.failUnlessExists(files) |
2849 | + self.assertPathExists(files) |
2850 | return tree |
2851 | |
2852 | def get_committed_tree(self, files, message="Committing"): |
2853 | @@ -41,11 +41,11 @@ |
2854 | |
2855 | def assertRemovedAndDeleted(self, files): |
2856 | self.assertNotInWorkingTree(files) |
2857 | - self.failIfExists(files) |
2858 | + self.assertPathDoesNotExist(files) |
2859 | |
2860 | def assertRemovedAndNotDeleted(self, files): |
2861 | self.assertNotInWorkingTree(files) |
2862 | - self.failUnlessExists(files) |
2863 | + self.assertPathExists(files) |
2864 | |
2865 | def test_remove_keep(self): |
2866 | """Check that files and directories are unversioned but not deleted.""" |
2867 | @@ -79,7 +79,7 @@ |
2868 | self.assertInWorkingTree(TestRemove.files) |
2869 | tree.remove(TestRemove.files, keep_files=False) |
2870 | self.assertNotInWorkingTree(TestRemove.files) |
2871 | - self.failUnlessExists(TestRemove.backup_files) |
2872 | + self.assertPathExists(TestRemove.backup_files) |
2873 | tree._validate() |
2874 | |
2875 | def test_remove_changed_file(self): |
2876 | @@ -89,7 +89,7 @@ |
2877 | self.assertInWorkingTree('a') |
2878 | tree.remove('a', keep_files=False) |
2879 | self.assertNotInWorkingTree(TestRemove.files) |
2880 | - self.failUnlessExists('a.~1~') |
2881 | + self.assertPathExists('a.~1~') |
2882 | tree._validate() |
2883 | |
2884 | def test_remove_deleted_files(self): |
2885 | @@ -98,7 +98,7 @@ |
2886 | for f in TestRemove.rfiles: |
2887 | osutils.delete_any(f) |
2888 | self.assertInWorkingTree(TestRemove.files) |
2889 | - self.failIfExists(TestRemove.files) |
2890 | + self.assertPathDoesNotExist(TestRemove.files) |
2891 | tree.remove(TestRemove.files, keep_files=False) |
2892 | self.assertRemovedAndDeleted(TestRemove.files) |
2893 | tree._validate() |
2894 | @@ -111,7 +111,7 @@ |
2895 | tree.rename_one(f,f+'x') |
2896 | rfilesx = ['bx/cx', 'bx', 'ax', 'dx'] |
2897 | self.assertInWorkingTree(rfilesx) |
2898 | - self.failUnlessExists(rfilesx) |
2899 | + self.assertPathExists(rfilesx) |
2900 | |
2901 | tree.remove(rfilesx, keep_files=False) |
2902 | self.assertRemovedAndDeleted(rfilesx) |
2903 | @@ -127,12 +127,12 @@ |
2904 | self.build_tree_contents([('ax','changed and renamed!'), |
2905 | ('bx/cx','changed and renamed!')]) |
2906 | self.assertInWorkingTree(rfilesx) |
2907 | - self.failUnlessExists(rfilesx) |
2908 | + self.assertPathExists(rfilesx) |
2909 | |
2910 | tree.remove(rfilesx, keep_files=False) |
2911 | self.assertNotInWorkingTree(rfilesx) |
2912 | - self.failUnlessExists(['bx.~1~/cx.~1~', 'bx.~1~', 'ax.~1~']) |
2913 | - self.failIfExists('dx.~1~') # unchanged file |
2914 | + self.assertPathExists(['bx.~1~/cx.~1~', 'bx.~1~', 'ax.~1~']) |
2915 | + self.assertPathDoesNotExist('dx.~1~') # unchanged file |
2916 | tree._validate() |
2917 | |
2918 | def test_force_remove_changed_files(self): |
2919 | @@ -143,7 +143,7 @@ |
2920 | |
2921 | tree.remove(TestRemove.files, keep_files=False, force=True) |
2922 | self.assertRemovedAndDeleted(TestRemove.files) |
2923 | - self.failIfExists(['a.~1~', 'b.~1~/', 'b.~1~/c', 'd.~1~/']) |
2924 | + self.assertPathDoesNotExist(['a.~1~', 'b.~1~/', 'b.~1~/c', 'd.~1~/']) |
2925 | tree._validate() |
2926 | |
2927 | def test_remove_unknown_files(self): |
2928 | @@ -151,7 +151,7 @@ |
2929 | tree = self.get_tree(TestRemove.files) |
2930 | tree.remove(TestRemove.files, keep_files=False) |
2931 | self.assertRemovedAndDeleted(TestRemove.files) |
2932 | - self.failUnlessExists(TestRemove.backup_files) |
2933 | + self.assertPathExists(TestRemove.backup_files) |
2934 | tree._validate() |
2935 | |
2936 | def test_remove_nonexisting_files(self): |
2937 | @@ -206,7 +206,7 @@ |
2938 | |
2939 | tree.remove(files, keep_files=False) |
2940 | self.assertNotInWorkingTree(files) |
2941 | - self.failUnlessExists('an_ignored_file.~1~') |
2942 | + self.assertPathExists('an_ignored_file.~1~') |
2943 | tree._validate() |
2944 | |
2945 | def test_dont_remove_directory_with_unknowns(self): |
2946 | @@ -216,18 +216,18 @@ |
2947 | |
2948 | self.build_tree(['a/unknown_file']) |
2949 | tree.remove('a', keep_files=False) |
2950 | - self.failUnlessExists('a.~1~/unknown_file') |
2951 | + self.assertPathExists('a.~1~/unknown_file') |
2952 | |
2953 | self.build_tree(['b/unknown_directory']) |
2954 | tree.remove('b', keep_files=False) |
2955 | - self.failUnlessExists('b.~1~/unknown_directory') |
2956 | + self.assertPathExists('b.~1~/unknown_directory') |
2957 | |
2958 | self.build_tree(['c/c/unknown_file']) |
2959 | tree.remove('c/c', keep_files=False) |
2960 | - self.failUnlessExists('c/c.~1~/unknown_file') |
2961 | + self.assertPathExists('c/c.~1~/unknown_file') |
2962 | |
2963 | tree.remove('c', keep_files=False) |
2964 | - self.failUnlessExists('c.~1~/') |
2965 | + self.assertPathExists('c.~1~/') |
2966 | |
2967 | self.assertNotInWorkingTree(directories) |
2968 | tree._validate() |
2969 | @@ -242,7 +242,7 @@ |
2970 | self.build_tree(other_files) |
2971 | |
2972 | self.assertInWorkingTree(files) |
2973 | - self.failUnlessExists(files) |
2974 | + self.assertPathExists(files) |
2975 | |
2976 | tree.remove('b', keep_files=False, force=True) |
2977 | |
2978 | @@ -257,7 +257,7 @@ |
2979 | self.build_tree_contents([('b/c', "some other new content!")]) |
2980 | |
2981 | tree.remove('b', keep_files=False) |
2982 | - self.failUnlessExists('b.~1~/c.~1~') |
2983 | + self.assertPathExists('b.~1~/c.~1~') |
2984 | self.assertNotInWorkingTree(files) |
2985 | |
2986 | def test_remove_force_directory_with_changed_file(self): |
2987 | @@ -281,9 +281,9 @@ |
2988 | tree.rename_one('somedir/file', 'moved-file') |
2989 | tree.remove('somedir', keep_files=False) |
2990 | self.assertNotInWorkingTree('somedir') |
2991 | - self.failIfExists('somedir') |
2992 | + self.assertPathDoesNotExist('somedir') |
2993 | self.assertInWorkingTree('moved-file') |
2994 | - self.failUnlessExists('moved-file') |
2995 | + self.assertPathExists('moved-file') |
2996 | |
2997 | def test_remove_directory_with_renames(self): |
2998 | """Delete directory with renames in or out.""" |
2999 | @@ -298,7 +298,7 @@ |
3000 | moved_files = ['b/file', 'b/directory/'] |
3001 | self.assertRemovedAndDeleted(files_to_move) |
3002 | self.assertInWorkingTree(moved_files) |
3003 | - self.failUnlessExists(moved_files) |
3004 | + self.assertPathExists(moved_files) |
3005 | |
3006 | # check if it works with renames out |
3007 | tree.remove('a', keep_files=False) |
3008 | @@ -315,7 +315,7 @@ |
3009 | tree.add(['dir', 'dir/file']) |
3010 | tree.commit('add file') |
3011 | tree.remove('dir/', keep_files=False) |
3012 | - self.failIfExists('tree/dir/file') |
3013 | + self.assertPathDoesNotExist('tree/dir/file') |
3014 | self.assertNotInWorkingTree('tree/dir/file', 'tree') |
3015 | tree._validate() |
3016 | |
3017 | @@ -324,15 +324,15 @@ |
3018 | tree = self.get_committed_tree(['a']) |
3019 | tree.remove('a', keep_files=False) |
3020 | tree.remove('a', keep_files=False) |
3021 | - self.failIfExists('a') |
3022 | + self.assertPathDoesNotExist('a') |
3023 | tree._validate() |
3024 | |
3025 | def test_remove_file_and_containing_dir(self): |
3026 | tree = self.get_committed_tree(['config/', 'config/file']) |
3027 | tree.remove('config/file', keep_files=False) |
3028 | tree.remove('config', keep_files=False) |
3029 | - self.failIfExists('config/file') |
3030 | - self.failIfExists('config') |
3031 | + self.assertPathDoesNotExist('config/file') |
3032 | + self.assertPathDoesNotExist('config') |
3033 | tree._validate() |
3034 | |
3035 | def test_remove_dir_before_bzr(self): |
3036 | @@ -340,6 +340,6 @@ |
3037 | # or the bug doesn't manifest itself. |
3038 | tree = self.get_committed_tree(['.aaa/', '.aaa/file']) |
3039 | tree.remove('.aaa/', keep_files=False) |
3040 | - self.failIfExists('.aaa/file') |
3041 | - self.failIfExists('.aaa') |
3042 | + self.assertPathDoesNotExist('.aaa/file') |
3043 | + self.assertPathDoesNotExist('.aaa') |
3044 | tree._validate() |
3045 | |
3046 | === modified file 'bzrlib/tests/per_workingtree/test_rename_one.py' |
3047 | --- bzrlib/tests/per_workingtree/test_rename_one.py 2009-08-26 13:04:49 +0000 |
3048 | +++ bzrlib/tests/per_workingtree/test_rename_one.py 2011-07-14 21:01:48 +0000 |
3049 | @@ -91,7 +91,7 @@ |
3050 | tree) |
3051 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id')], |
3052 | tree.basis_tree()) |
3053 | - self.failIfExists('a') |
3054 | + self.assertPathDoesNotExist('a') |
3055 | self.assertFileEqual(a_contents, 'foo') |
3056 | |
3057 | def test_rename_one_not_localdir(self): |
3058 | @@ -107,7 +107,7 @@ |
3059 | tree) |
3060 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id')], |
3061 | tree.basis_tree()) |
3062 | - self.failIfExists('tree/a') |
3063 | + self.assertPathDoesNotExist('tree/a') |
3064 | self.assertFileEqual(a_contents, 'tree/b/foo') |
3065 | |
3066 | def test_rename_one_subdir(self): |
3067 | @@ -126,7 +126,7 @@ |
3068 | ('b/d', 'a-id')], tree) |
3069 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id'), |
3070 | ('b/c', 'c-id')], tree.basis_tree()) |
3071 | - self.failIfExists('a') |
3072 | + self.assertPathDoesNotExist('a') |
3073 | self.assertFileEqual(a_contents, 'b/d') |
3074 | |
3075 | def test_rename_one_parent_dir(self): |
3076 | @@ -141,7 +141,7 @@ |
3077 | ('d', 'c-id')], tree) |
3078 | self.assertTreeLayout([('', root_id), ('a', 'a-id'), ('b', 'b-id'), |
3079 | ('b/c', 'c-id')], tree.basis_tree()) |
3080 | - self.failIfExists('b/c') |
3081 | + self.assertPathDoesNotExist('b/c') |
3082 | self.assertFileEqual(c_contents, 'd') |
3083 | |
3084 | def test_rename_one_fail_consistent(self): |
3085 | |
3086 | === modified file 'bzrlib/tests/per_workingtree/test_workingtree.py' |
3087 | --- bzrlib/tests/per_workingtree/test_workingtree.py 2011-01-21 22:08:19 +0000 |
3088 | +++ bzrlib/tests/per_workingtree/test_workingtree.py 2011-07-14 21:01:48 +0000 |
3089 | @@ -204,7 +204,7 @@ |
3090 | os.unlink('hello.txt') |
3091 | tree.remove('hello.txt') |
3092 | tree.revert(['hello.txt']) |
3093 | - self.failUnlessExists('hello.txt') |
3094 | + self.assertPathExists('hello.txt') |
3095 | |
3096 | def test_versioned_files_not_unknown(self): |
3097 | tree = self.make_branch_and_tree('.') |
3098 | @@ -399,12 +399,12 @@ |
3099 | wt.set_parent_ids(['B']) |
3100 | tree = wt.basis_tree() |
3101 | tree.lock_read() |
3102 | - self.failUnless(tree.has_filename('bar')) |
3103 | + self.assertTrue(tree.has_filename('bar')) |
3104 | tree.unlock() |
3105 | wt.set_parent_ids(['A']) |
3106 | tree = wt.basis_tree() |
3107 | tree.lock_read() |
3108 | - self.failUnless(tree.has_filename('foo')) |
3109 | + self.assertTrue(tree.has_filename('foo')) |
3110 | tree.unlock() |
3111 | |
3112 | def test_clone_tree_revision(self): |
3113 | @@ -465,7 +465,7 @@ |
3114 | wt.commit('A', rev_id='A') |
3115 | # and update old_tree |
3116 | self.assertEqual(0, old_tree.update()) |
3117 | - self.failUnlessExists('checkout/file') |
3118 | + self.assertPathExists('checkout/file') |
3119 | self.assertEqual(['A'], old_tree.get_parent_ids()) |
3120 | |
3121 | def test_update_sets_root_id(self): |
3122 | @@ -486,7 +486,7 @@ |
3123 | wt.commit('A', rev_id='A') |
3124 | # and update checkout |
3125 | self.assertEqual(0, checkout.update()) |
3126 | - self.failUnlessExists('checkout/file') |
3127 | + self.assertPathExists('checkout/file') |
3128 | self.assertEqual(wt.get_root_id(), checkout.get_root_id()) |
3129 | self.assertNotEqual(None, wt.get_root_id()) |
3130 | |
3131 | @@ -567,10 +567,10 @@ |
3132 | a.close() |
3133 | this.revert() |
3134 | self.assertFileEqual('a test\n', 'b1/a') |
3135 | - self.failUnlessExists('b1/b.~1~') |
3136 | - self.failIfExists('b1/c') |
3137 | - self.failIfExists('b1/a.~1~') |
3138 | - self.failUnlessExists('b1/d') |
3139 | + self.assertPathExists('b1/b.~1~') |
3140 | + self.assertPathDoesNotExist('b1/c') |
3141 | + self.assertPathDoesNotExist('b1/a.~1~') |
3142 | + self.assertPathExists('b1/d') |
3143 | |
3144 | def test_update_updates_bound_branch_no_local_commits(self): |
3145 | # doing an update in a tree updates the branch its bound to too. |
3146 | @@ -739,7 +739,7 @@ |
3147 | def test_format_description(self): |
3148 | tree = self.make_branch_and_tree('tree') |
3149 | text = tree._format.get_format_description() |
3150 | - self.failUnless(len(text)) |
3151 | + self.assertTrue(len(text)) |
3152 | |
3153 | def test_branch_attribute_is_not_settable(self): |
3154 | # the branch attribute is an aspect of the working tree, not a |
3155 | @@ -1063,9 +1063,9 @@ |
3156 | self.assertEqual(0, wt.update(revision='1')) |
3157 | self.assertEqual('1', wt.last_revision()) |
3158 | self.assertEqual(tip, wt.branch.last_revision()) |
3159 | - self.failUnlessExists('checkout/file1') |
3160 | - self.failIfExists('checkout/file4') |
3161 | - self.failIfExists('checkout/file5') |
3162 | + self.assertPathExists('checkout/file1') |
3163 | + self.assertPathDoesNotExist('checkout/file4') |
3164 | + self.assertPathDoesNotExist('checkout/file5') |
3165 | |
3166 | |
3167 | class TestIllegalPaths(TestCaseWithWorkingTree): |
3168 | |
3169 | === modified file 'bzrlib/tests/test_atomicfile.py' |
3170 | --- bzrlib/tests/test_atomicfile.py 2009-04-11 14:25:12 +0000 |
3171 | +++ bzrlib/tests/test_atomicfile.py 2011-07-14 21:01:48 +0000 |
3172 | @@ -33,7 +33,7 @@ |
3173 | |
3174 | def test_commit(self): |
3175 | f = atomicfile.AtomicFile('test') |
3176 | - self.failIfExists('test') |
3177 | + self.assertPathDoesNotExist('test') |
3178 | f.write('foo\n') |
3179 | f.commit() |
3180 | |
3181 | |
3182 | === modified file 'bzrlib/tests/test_branch.py' |
3183 | --- bzrlib/tests/test_branch.py 2011-02-03 18:58:06 +0000 |
3184 | +++ bzrlib/tests/test_branch.py 2011-07-14 21:01:48 +0000 |
3185 | @@ -160,7 +160,7 @@ |
3186 | dir.create_repository() |
3187 | format.initialize(dir) |
3188 | found_format = _mod_branch.BranchFormat.find_format(dir) |
3189 | - self.failUnless(isinstance(found_format, format.__class__)) |
3190 | + self.assertIsInstance(found_format, format.__class__) |
3191 | check_format(_mod_branch.BzrBranchFormat5(), "bar") |
3192 | |
3193 | def test_find_format_factory(self): |
3194 | @@ -260,22 +260,22 @@ |
3195 | |
3196 | def test_layout(self): |
3197 | branch = self.make_branch('a', format=self.get_format_name()) |
3198 | - self.failUnlessExists('a/.bzr/branch/last-revision') |
3199 | - self.failIfExists('a/.bzr/branch/revision-history') |
3200 | - self.failIfExists('a/.bzr/branch/references') |
3201 | + self.assertPathExists('a/.bzr/branch/last-revision') |
3202 | + self.assertPathDoesNotExist('a/.bzr/branch/revision-history') |
3203 | + self.assertPathDoesNotExist('a/.bzr/branch/references') |
3204 | |
3205 | def test_config(self): |
3206 | """Ensure that all configuration data is stored in the branch""" |
3207 | branch = self.make_branch('a', format=self.get_format_name()) |
3208 | branch.set_parent('http://example.com') |
3209 | - self.failIfExists('a/.bzr/branch/parent') |
3210 | + self.assertPathDoesNotExist('a/.bzr/branch/parent') |
3211 | self.assertEqual('http://example.com', branch.get_parent()) |
3212 | branch.set_push_location('sftp://example.com') |
3213 | config = branch.get_config()._get_branch_data_config() |
3214 | self.assertEqual('sftp://example.com', |
3215 | config.get_user_option('push_location')) |
3216 | branch.set_bound_location('ftp://example.com') |
3217 | - self.failIfExists('a/.bzr/branch/bound') |
3218 | + self.assertPathDoesNotExist('a/.bzr/branch/bound') |
3219 | self.assertEqual('ftp://example.com', branch.get_bound_location()) |
3220 | |
3221 | def test_set_revision_history(self): |
3222 | @@ -309,10 +309,10 @@ |
3223 | subtree.commit('a subtree file') |
3224 | subsubtree.commit('a subsubtree file') |
3225 | tree.branch.create_checkout('target', lightweight=lightweight) |
3226 | - self.failUnlessExists('target') |
3227 | - self.failUnlessExists('target/subtree') |
3228 | - self.failUnlessExists('target/subtree/file') |
3229 | - self.failUnlessExists('target/subtree/subsubtree/file') |
3230 | + self.assertPathExists('target') |
3231 | + self.assertPathExists('target/subtree') |
3232 | + self.assertPathExists('target/subtree/file') |
3233 | + self.assertPathExists('target/subtree/subsubtree/file') |
3234 | subbranch = _mod_branch.Branch.open('target/subtree/subsubtree') |
3235 | if lightweight: |
3236 | self.assertEndsWith(subbranch.base, 'source/subtree/subsubtree/') |
3237 | |
3238 | === modified file 'bzrlib/tests/test_bundle.py' |
3239 | --- bzrlib/tests/test_bundle.py 2011-01-21 22:08:19 +0000 |
3240 | +++ bzrlib/tests/test_bundle.py 2011-07-14 21:01:48 +0000 |
3241 | @@ -1409,7 +1409,7 @@ |
3242 | branch = tree_a.branch |
3243 | repo_a = branch.repository |
3244 | tree_a.commit("base", allow_pointless=True, rev_id='A') |
3245 | - self.failIf(branch.repository.has_signature_for_revision_id('A')) |
3246 | + self.assertFalse(branch.repository.has_signature_for_revision_id('A')) |
3247 | try: |
3248 | from bzrlib.testament import Testament |
3249 | # monkey patch gpg signing mechanism |
3250 | |
3251 | === modified file 'bzrlib/tests/test_bzrdir.py' |
3252 | --- bzrlib/tests/test_bzrdir.py 2011-02-03 18:58:06 +0000 |
3253 | +++ bzrlib/tests/test_bzrdir.py 2011-07-14 21:01:48 +0000 |
3254 | @@ -70,13 +70,12 @@ |
3255 | |
3256 | def test_get_set_default_format(self): |
3257 | old_format = bzrdir.BzrDirFormat.get_default_format() |
3258 | - # default is BzrDirFormat6 |
3259 | - self.failUnless(isinstance(old_format, bzrdir.BzrDirMetaFormat1)) |
3260 | + self.assertIsInstance(old_format, bzrdir.BzrDirMetaFormat1) |
3261 | controldir.ControlDirFormat._set_default_format(SampleBzrDirFormat()) |
3262 | # creating a bzr dir should now create an instrumented dir. |
3263 | try: |
3264 | result = bzrdir.BzrDir.create('memory:///') |
3265 | - self.failUnless(isinstance(result, SampleBzrDir)) |
3266 | + self.assertIsInstance(result, SampleBzrDir) |
3267 | finally: |
3268 | controldir.ControlDirFormat._set_default_format(old_format) |
3269 | self.assertEqual(old_format, bzrdir.BzrDirFormat.get_default_format()) |
3270 | @@ -260,7 +259,7 @@ |
3271 | format.initialize(url) |
3272 | t = _mod_transport.get_transport(url) |
3273 | found_format = bzrdir.BzrDirFormat.find_format(t) |
3274 | - self.failUnless(isinstance(found_format, format.__class__)) |
3275 | + self.assertIsInstance(found_format, format.__class__) |
3276 | check_format(bzrdir.BzrDirFormat5(), "foo") |
3277 | check_format(bzrdir.BzrDirFormat6(), "bar") |
3278 | |
3279 | @@ -771,7 +770,7 @@ |
3280 | tree2 = tree.bzrdir.sprout('tree2').open_workingtree() |
3281 | tree2.lock_read() |
3282 | self.addCleanup(tree2.unlock) |
3283 | - self.failUnlessExists('tree2/subtree/file') |
3284 | + self.assertPathExists('tree2/subtree/file') |
3285 | self.assertEqual('tree-reference', tree2.kind('subtree-root')) |
3286 | |
3287 | def test_cloning_metadir(self): |
3288 | @@ -811,8 +810,8 @@ |
3289 | # #634470. -- vila 20100909 |
3290 | self.assertRaises(errors.NotBranchError, |
3291 | tree.bzrdir.sprout, 'repo/tree2') |
3292 | -# self.failUnlessExists('repo/tree2/subtree') |
3293 | -# self.failIfExists('repo/tree2/subtree/file') |
3294 | +# self.assertPathExists('repo/tree2/subtree') |
3295 | +# self.assertPathDoesNotExist('repo/tree2/subtree/file') |
3296 | |
3297 | def make_foo_bar_baz(self): |
3298 | foo = bzrdir.BzrDir.create_branch_convenience('foo').bzrdir |
3299 | |
3300 | === modified file 'bzrlib/tests/test_cache_utf8.py' |
3301 | --- bzrlib/tests/test_cache_utf8.py 2009-04-11 14:25:12 +0000 |
3302 | +++ bzrlib/tests/test_cache_utf8.py 2011-07-14 21:01:48 +0000 |
3303 | @@ -31,37 +31,37 @@ |
3304 | |
3305 | def check_encode(self, rev_id): |
3306 | rev_id_utf8 = rev_id.encode('utf-8') |
3307 | - self.failIf(rev_id in cache_utf8._unicode_to_utf8_map) |
3308 | - self.failIf(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3309 | + self.assertFalse(rev_id in cache_utf8._unicode_to_utf8_map) |
3310 | + self.assertFalse(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3311 | |
3312 | # After a single encode, the mapping should exist for |
3313 | # both directions |
3314 | self.assertEqual(rev_id_utf8, cache_utf8.encode(rev_id)) |
3315 | - self.failUnless(rev_id in cache_utf8._unicode_to_utf8_map) |
3316 | - self.failUnless(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3317 | + self.assertTrue(rev_id in cache_utf8._unicode_to_utf8_map) |
3318 | + self.assertTrue(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3319 | |
3320 | self.assertEqual(rev_id, cache_utf8.decode(rev_id_utf8)) |
3321 | |
3322 | cache_utf8.clear_encoding_cache() |
3323 | - self.failIf(rev_id in cache_utf8._unicode_to_utf8_map) |
3324 | - self.failIf(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3325 | + self.assertFalse(rev_id in cache_utf8._unicode_to_utf8_map) |
3326 | + self.assertFalse(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3327 | |
3328 | def check_decode(self, rev_id): |
3329 | rev_id_utf8 = rev_id.encode('utf-8') |
3330 | - self.failIf(rev_id in cache_utf8._unicode_to_utf8_map) |
3331 | - self.failIf(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3332 | + self.assertFalse(rev_id in cache_utf8._unicode_to_utf8_map) |
3333 | + self.assertFalse(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3334 | |
3335 | # After a single decode, the mapping should exist for |
3336 | # both directions |
3337 | self.assertEqual(rev_id, cache_utf8.decode(rev_id_utf8)) |
3338 | - self.failUnless(rev_id in cache_utf8._unicode_to_utf8_map) |
3339 | - self.failUnless(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3340 | + self.assertTrue(rev_id in cache_utf8._unicode_to_utf8_map) |
3341 | + self.assertTrue(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3342 | |
3343 | self.assertEqual(rev_id_utf8, cache_utf8.encode(rev_id)) |
3344 | cache_utf8.clear_encoding_cache() |
3345 | |
3346 | - self.failIf(rev_id in cache_utf8._unicode_to_utf8_map) |
3347 | - self.failIf(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3348 | + self.assertFalse(rev_id in cache_utf8._unicode_to_utf8_map) |
3349 | + self.assertFalse(rev_id_utf8 in cache_utf8._utf8_to_unicode_map) |
3350 | |
3351 | def test_ascii(self): |
3352 | self.check_decode(u'all_ascii_characters123123123') |
3353 | @@ -74,7 +74,7 @@ |
3354 | def test_cached_unicode(self): |
3355 | x = u'\xb5yy' + u'\xe5zz' |
3356 | y = u'\xb5yy' + u'\xe5zz' |
3357 | - self.failIf(x is y) |
3358 | + self.assertFalse(x is y) |
3359 | xp = cache_utf8.get_cached_unicode(x) |
3360 | yp = cache_utf8.get_cached_unicode(y) |
3361 | |
3362 | @@ -84,7 +84,7 @@ |
3363 | def test_cached_utf8(self): |
3364 | x = u'\xb5yy\xe5zz'.encode('utf8') |
3365 | y = u'\xb5yy\xe5zz'.encode('utf8') |
3366 | - self.failIf(x is y) |
3367 | + self.assertFalse(x is y) |
3368 | xp = cache_utf8.get_cached_utf8(x) |
3369 | yp = cache_utf8.get_cached_utf8(y) |
3370 | |
3371 | @@ -94,7 +94,7 @@ |
3372 | def test_cached_ascii(self): |
3373 | x = '%s %s' % ('simple', 'text') |
3374 | y = '%s %s' % ('simple', 'text') |
3375 | - self.failIf(x is y) |
3376 | + self.assertFalse(x is y) |
3377 | xp = cache_utf8.get_cached_ascii(x) |
3378 | yp = cache_utf8.get_cached_ascii(y) |
3379 | |
3380 | |
3381 | === modified file 'bzrlib/tests/test_clean_tree.py' |
3382 | --- bzrlib/tests/test_clean_tree.py 2011-01-21 22:08:19 +0000 |
3383 | +++ bzrlib/tests/test_clean_tree.py 2011-07-14 21:01:48 +0000 |
3384 | @@ -46,12 +46,12 @@ |
3385 | BzrDir.create_standalone_workingtree('branch') |
3386 | os.symlink(os.path.realpath('no-die-please'), 'branch/die-please') |
3387 | os.mkdir('no-die-please') |
3388 | - self.failUnlessExists('branch/die-please') |
3389 | + self.assertPathExists('branch/die-please') |
3390 | os.mkdir('no-die-please/child') |
3391 | |
3392 | clean_tree('branch', unknown=True, no_prompt=True) |
3393 | - self.failUnlessExists('no-die-please') |
3394 | - self.failUnlessExists('no-die-please/child') |
3395 | + self.assertPathExists('no-die-please') |
3396 | + self.assertPathExists('no-die-please/child') |
3397 | |
3398 | def test_iter_deletable(self): |
3399 | """Files are selected for deletion appropriately""" |
3400 | |
3401 | === modified file 'bzrlib/tests/test_commit.py' |
3402 | --- bzrlib/tests/test_commit.py 2011-01-21 22:08:19 +0000 |
3403 | +++ bzrlib/tests/test_commit.py 2011-07-14 21:01:48 +0000 |
3404 | @@ -381,7 +381,7 @@ |
3405 | wt = self.make_branch_and_tree('.') |
3406 | branch = wt.branch |
3407 | wt.commit("base", allow_pointless=True, rev_id='A') |
3408 | - self.failIf(branch.repository.has_signature_for_revision_id('A')) |
3409 | + self.assertFalse(branch.repository.has_signature_for_revision_id('A')) |
3410 | try: |
3411 | from bzrlib.testament import Testament |
3412 | # monkey patch gpg signing mechanism |
3413 | @@ -405,7 +405,7 @@ |
3414 | wt = self.make_branch_and_tree('.') |
3415 | branch = wt.branch |
3416 | wt.commit("base", allow_pointless=True, rev_id='A') |
3417 | - self.failIf(branch.repository.has_signature_for_revision_id('A')) |
3418 | + self.assertFalse(branch.repository.has_signature_for_revision_id('A')) |
3419 | try: |
3420 | from bzrlib.testament import Testament |
3421 | # monkey patch gpg signing mechanism |
3422 | @@ -419,7 +419,7 @@ |
3423 | working_tree=wt) |
3424 | branch = Branch.open(self.get_url('.')) |
3425 | self.assertEqual(branch.revision_history(), ['A']) |
3426 | - self.failIf(branch.repository.has_revision('B')) |
3427 | + self.assertFalse(branch.repository.has_revision('B')) |
3428 | finally: |
3429 | bzrlib.gpg.GPGStrategy = oldstrategy |
3430 | |
3431 | |
3432 | === modified file 'bzrlib/tests/test_config.py' |
3433 | --- bzrlib/tests/test_config.py 2011-03-13 15:08:21 +0000 |
3434 | +++ bzrlib/tests/test_config.py 2011-07-14 21:01:48 +0000 |
3435 | @@ -41,6 +41,7 @@ |
3436 | ) |
3437 | from bzrlib.tests import ( |
3438 | features, |
3439 | + TestSkipped, |
3440 | scenarios, |
3441 | ) |
3442 | import configobj |
3443 | @@ -505,7 +506,7 @@ |
3444 | def test_cached(self): |
3445 | my_config = config.IniBasedConfig.from_string(sample_config_text) |
3446 | parser = my_config._get_parser() |
3447 | - self.failUnless(my_config._get_parser() is parser) |
3448 | + self.assertTrue(my_config._get_parser() is parser) |
3449 | |
3450 | def _dummy_chown(self, path, uid, gid): |
3451 | self.path, self.uid, self.gid = path, uid, gid |
3452 | @@ -764,7 +765,7 @@ |
3453 | parser = my_config._get_parser() |
3454 | finally: |
3455 | config.ConfigObj = oldparserclass |
3456 | - self.failUnless(isinstance(parser, InstrumentedConfigObj)) |
3457 | + self.assertIsInstance(parser, InstrumentedConfigObj) |
3458 | self.assertEqual(parser._calls, [('__init__', config.config_filename(), |
3459 | 'utf-8')]) |
3460 | |
3461 | @@ -781,7 +782,7 @@ |
3462 | my_config = config.BranchConfig(branch) |
3463 | location_config = my_config._get_location_config() |
3464 | self.assertEqual(branch.base, location_config.location) |
3465 | - self.failUnless(location_config is my_config._get_location_config()) |
3466 | + self.assertIs(location_config, my_config._get_location_config()) |
3467 | |
3468 | def test_get_config(self): |
3469 | """The Branch.get_config method works properly""" |
3470 | @@ -1020,7 +1021,7 @@ |
3471 | parser = my_config._get_parser() |
3472 | finally: |
3473 | config.ConfigObj = oldparserclass |
3474 | - self.failUnless(isinstance(parser, InstrumentedConfigObj)) |
3475 | + self.assertIsInstance(parser, InstrumentedConfigObj) |
3476 | self.assertEqual(parser._calls, |
3477 | [('__init__', config.locations_config_filename(), |
3478 | 'utf-8')]) |
3479 | @@ -1028,8 +1029,8 @@ |
3480 | def test_get_global_config(self): |
3481 | my_config = config.BranchConfig(FakeBranch('http://example.com')) |
3482 | global_config = my_config._get_global_config() |
3483 | - self.failUnless(isinstance(global_config, config.GlobalConfig)) |
3484 | - self.failUnless(global_config is my_config._get_global_config()) |
3485 | + self.assertIsInstance(global_config, config.GlobalConfig) |
3486 | + self.assertIs(global_config, my_config._get_global_config()) |
3487 | |
3488 | def test__get_matching_sections_no_match(self): |
3489 | self.get_branch_config('/') |
3490 | @@ -2237,3 +2238,25 @@ |
3491 | # test_user_prompted ? |
3492 | class TestAuthenticationRing(tests.TestCaseWithTransport): |
3493 | pass |
3494 | + |
3495 | + |
3496 | +class TestAutoUserId(tests.TestCase): |
3497 | + """Test inferring an automatic user name.""" |
3498 | + |
3499 | + def test_auto_user_id(self): |
3500 | + """Automatic inference of user name. |
3501 | + |
3502 | + This is a bit hard to test in an isolated way, because it depends on |
3503 | + system functions that go direct to /etc or perhaps somewhere else. |
3504 | + But it's reasonable to say that on Unix, with an /etc/mailname, we ought |
3505 | + to be able to choose a user name with no configuration. |
3506 | + """ |
3507 | + if sys.platform == 'win32': |
3508 | + raise TestSkipped("User name inference not implemented on win32") |
3509 | + realname, address = config._auto_user_id() |
3510 | + if os.path.exists('/etc/mailname'): |
3511 | + self.assertTrue(realname) |
3512 | + self.assertTrue(address) |
3513 | + else: |
3514 | + self.assertEquals((None, None), (realname, address)) |
3515 | + |
3516 | |
3517 | === modified file 'bzrlib/tests/test_conflicts.py' |
3518 | --- bzrlib/tests/test_conflicts.py 2011-03-13 15:08:21 +0000 |
3519 | +++ bzrlib/tests/test_conflicts.py 2011-07-14 21:01:48 +0000 |
3520 | @@ -473,7 +473,7 @@ |
3521 | return [('unversion', 'file-id')] |
3522 | |
3523 | def check_file_doesnt_exist(self): |
3524 | - self.failIfExists('branch/file') |
3525 | + self.assertPathDoesNotExist('branch/file') |
3526 | |
3527 | def do_create_file_in_dir(self): |
3528 | return [('add', ('dir', 'dir-id', 'directory', '')), |
3529 | @@ -486,7 +486,7 @@ |
3530 | self.assertFileEqual('trunk content\nmore content\n', 'branch/dir/file') |
3531 | |
3532 | def check_file_in_dir_doesnt_exist(self): |
3533 | - self.failIfExists('branch/dir/file') |
3534 | + self.assertPathDoesNotExist('branch/dir/file') |
3535 | |
3536 | def _get_resolve_path_arg(self, wt, action): |
3537 | return self._path |
3538 | @@ -567,41 +567,41 @@ |
3539 | return [('rename', ('file', 'new-file'))] |
3540 | |
3541 | def check_file_renamed(self): |
3542 | - self.failIfExists('branch/file') |
3543 | - self.failUnlessExists('branch/new-file') |
3544 | + self.assertPathDoesNotExist('branch/file') |
3545 | + self.assertPathExists('branch/new-file') |
3546 | |
3547 | def do_rename_file2(self): |
3548 | return [('rename', ('file', 'new-file2'))] |
3549 | |
3550 | def check_file_renamed2(self): |
3551 | - self.failIfExists('branch/file') |
3552 | - self.failUnlessExists('branch/new-file2') |
3553 | + self.assertPathDoesNotExist('branch/file') |
3554 | + self.assertPathExists('branch/new-file2') |
3555 | |
3556 | def do_rename_dir(self): |
3557 | return [('rename', ('dir', 'new-dir'))] |
3558 | |
3559 | def check_dir_renamed(self): |
3560 | - self.failIfExists('branch/dir') |
3561 | - self.failUnlessExists('branch/new-dir') |
3562 | + self.assertPathDoesNotExist('branch/dir') |
3563 | + self.assertPathExists('branch/new-dir') |
3564 | |
3565 | def do_rename_dir2(self): |
3566 | return [('rename', ('dir', 'new-dir2'))] |
3567 | |
3568 | def check_dir_renamed2(self): |
3569 | - self.failIfExists('branch/dir') |
3570 | - self.failUnlessExists('branch/new-dir2') |
3571 | + self.assertPathDoesNotExist('branch/dir') |
3572 | + self.assertPathExists('branch/new-dir2') |
3573 | |
3574 | def do_delete_file(self): |
3575 | return [('unversion', 'file-id')] |
3576 | |
3577 | def check_file_doesnt_exist(self): |
3578 | - self.failIfExists('branch/file') |
3579 | + self.assertPathDoesNotExist('branch/file') |
3580 | |
3581 | def do_delete_dir(self): |
3582 | return [('unversion', 'dir-id')] |
3583 | |
3584 | def check_dir_doesnt_exist(self): |
3585 | - self.failIfExists('branch/dir') |
3586 | + self.assertPathDoesNotExist('branch/dir') |
3587 | |
3588 | def do_create_file_in_dir(self): |
3589 | return [('add', ('dir', 'dir-id', 'directory', '')), |
3590 | @@ -611,11 +611,11 @@ |
3591 | return [('rename', ('dir/file', 'dir/new-file'))] |
3592 | |
3593 | def check_file_in_dir_renamed(self): |
3594 | - self.failIfExists('branch/dir/file') |
3595 | - self.failUnlessExists('branch/dir/new-file') |
3596 | + self.assertPathDoesNotExist('branch/dir/file') |
3597 | + self.assertPathExists('branch/dir/new-file') |
3598 | |
3599 | def check_file_in_dir_doesnt_exist(self): |
3600 | - self.failIfExists('branch/dir/file') |
3601 | + self.assertPathDoesNotExist('branch/dir/file') |
3602 | |
3603 | def _get_resolve_path_arg(self, wt, action): |
3604 | tpath = self._this['path'] |
3605 | @@ -912,15 +912,15 @@ |
3606 | return [('rename', ('dir1', 'dir2/dir1'))] |
3607 | |
3608 | def check_dir1_moved(self): |
3609 | - self.failIfExists('branch/dir1') |
3610 | - self.failUnlessExists('branch/dir2/dir1') |
3611 | + self.assertPathDoesNotExist('branch/dir1') |
3612 | + self.assertPathExists('branch/dir2/dir1') |
3613 | |
3614 | def do_move_dir2_into_dir1(self): |
3615 | return [('rename', ('dir2', 'dir1/dir2'))] |
3616 | |
3617 | def check_dir2_moved(self): |
3618 | - self.failIfExists('branch/dir2') |
3619 | - self.failUnlessExists('branch/dir1/dir2') |
3620 | + self.assertPathDoesNotExist('branch/dir2') |
3621 | + self.assertPathExists('branch/dir1/dir2') |
3622 | |
3623 | def do_create_dir1_4(self): |
3624 | return [('add', ('dir1', 'dir1-id', 'directory', '')), |
3625 | @@ -932,17 +932,17 @@ |
3626 | return [('rename', ('dir1', 'dir3/dir4/dir1'))] |
3627 | |
3628 | def check_dir1_2_moved(self): |
3629 | - self.failIfExists('branch/dir1') |
3630 | - self.failUnlessExists('branch/dir3/dir4/dir1') |
3631 | - self.failUnlessExists('branch/dir3/dir4/dir1/dir2') |
3632 | + self.assertPathDoesNotExist('branch/dir1') |
3633 | + self.assertPathExists('branch/dir3/dir4/dir1') |
3634 | + self.assertPathExists('branch/dir3/dir4/dir1/dir2') |
3635 | |
3636 | def do_move_dir3_into_dir2(self): |
3637 | return [('rename', ('dir3', 'dir1/dir2/dir3'))] |
3638 | |
3639 | def check_dir3_4_moved(self): |
3640 | - self.failIfExists('branch/dir3') |
3641 | - self.failUnlessExists('branch/dir1/dir2/dir3') |
3642 | - self.failUnlessExists('branch/dir1/dir2/dir3/dir4') |
3643 | + self.assertPathDoesNotExist('branch/dir3') |
3644 | + self.assertPathExists('branch/dir1/dir2/dir3') |
3645 | + self.assertPathExists('branch/dir1/dir2/dir3/dir4') |
3646 | |
3647 | def _get_resolve_path_arg(self, wt, action): |
3648 | # ParentLoop says: moving <conflict_path> into <path>. Cancelled move. |
3649 | @@ -1051,6 +1051,72 @@ |
3650 | """) |
3651 | |
3652 | |
3653 | +class TestNoFinalPath(script.TestCaseWithTransportAndScript): |
3654 | + |
3655 | + def test_bug_805809(self): |
3656 | + self.run_script(""" |
3657 | +$ bzr init trunk |
3658 | +Created a standalone tree (format: 2a) |
3659 | +$ cd trunk |
3660 | +$ echo trunk >file |
3661 | +$ bzr add |
3662 | +adding file |
3663 | +$ bzr commit -m 'create file on trunk' |
3664 | +2>Committing to: .../trunk/ |
3665 | +2>added file |
3666 | +2>Committed revision 1. |
3667 | +# Create a debian branch based on trunk |
3668 | +$ cd .. |
3669 | +$ bzr branch trunk -r 1 debian |
3670 | +2>Branched 1 revision(s). |
3671 | +$ cd debian |
3672 | +$ mkdir dir |
3673 | +$ bzr add |
3674 | +adding dir |
3675 | +$ bzr mv file dir |
3676 | +file => dir/file |
3677 | +$ bzr commit -m 'rename file to dir/file for debian' |
3678 | +2>Committing to: .../debian/ |
3679 | +2>added dir |
3680 | +2>renamed file => dir/file |
3681 | +2>Committed revision 2. |
3682 | +# Create an experimental branch with a new root-id |
3683 | +$ cd .. |
3684 | +$ bzr init experimental |
3685 | +Created a standalone tree (format: 2a) |
3686 | +$ cd experimental |
3687 | +# merge debian even without a common ancestor |
3688 | +$ bzr merge ../debian -r0..2 |
3689 | +2>+N dir/ |
3690 | +2>+N dir/file |
3691 | +2>All changes applied successfully. |
3692 | +$ bzr commit -m 'merging debian into experimental' |
3693 | +2>Committing to: .../experimental/ |
3694 | +2>deleted |
3695 | +2>modified dir |
3696 | +2>Committed revision 1. |
3697 | +# Create an ubuntu branch with yet another root-id |
3698 | +$ cd .. |
3699 | +$ bzr init ubuntu |
3700 | +Created a standalone tree (format: 2a) |
3701 | +$ cd ubuntu |
3702 | +# Also merge debian |
3703 | +$ bzr merge ../debian -r0..2 |
3704 | +2>+N dir/ |
3705 | +2>+N dir/file |
3706 | +2>All changes applied successfully. |
3707 | +$ bzr commit -m 'merging debian' |
3708 | +2>Committing to: .../ubuntu/ |
3709 | +2>deleted |
3710 | +2>modified dir |
3711 | +2>Committed revision 1. |
3712 | +# Now try to merge experimental |
3713 | +$ bzr merge ../experimental |
3714 | +2>Path conflict: dir / dir |
3715 | +2>1 conflicts encountered. |
3716 | +""") |
3717 | + |
3718 | + |
3719 | class TestResolveActionOption(tests.TestCase): |
3720 | |
3721 | def setUp(self): |
3722 | |
3723 | === modified file 'bzrlib/tests/test_crash.py' |
3724 | --- bzrlib/tests/test_crash.py 2011-01-21 22:08:19 +0000 |
3725 | +++ bzrlib/tests/test_crash.py 2011-07-14 21:01:48 +0000 |
3726 | @@ -15,17 +15,18 @@ |
3727 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3728 | |
3729 | |
3730 | +import doctest |
3731 | +import os |
3732 | from StringIO import StringIO |
3733 | import sys |
3734 | |
3735 | - |
3736 | -import os |
3737 | - |
3738 | +from testtools.matchers import DocTestMatches |
3739 | |
3740 | from bzrlib import ( |
3741 | config, |
3742 | crash, |
3743 | osutils, |
3744 | + plugin, |
3745 | tests, |
3746 | ) |
3747 | |
3748 | @@ -71,3 +72,45 @@ |
3749 | self.assertContainsRe(report, 'test_apport_report') |
3750 | # should also be in there |
3751 | self.assertContainsRe(report, '(?m)^CommandLine:') |
3752 | + |
3753 | + |
3754 | +class TestNonApportReporting(tests.TestCase): |
3755 | + """Reporting of crash-type bugs without apport. |
3756 | + |
3757 | + This should work in all environments. |
3758 | + """ |
3759 | + |
3760 | + def setup_fake_plugins(self): |
3761 | + def fake_plugins(): |
3762 | + fake = plugin.PlugIn('fake_plugin', plugin) |
3763 | + fake.version_info = lambda: (1, 2, 3) |
3764 | + return {"fake_plugin": fake} |
3765 | + self.overrideAttr(plugin, 'plugins', fake_plugins) |
3766 | + |
3767 | + def test_report_bug_legacy(self): |
3768 | + self.setup_fake_plugins() |
3769 | + err_file = StringIO() |
3770 | + try: |
3771 | + raise AssertionError("my error") |
3772 | + except AssertionError, e: |
3773 | + pass |
3774 | + crash.report_bug_legacy(sys.exc_info(), err_file) |
3775 | + self.assertThat( |
3776 | + err_file.getvalue(), |
3777 | + DocTestMatches("""\ |
3778 | +bzr: ERROR: exceptions.AssertionError: my error |
3779 | + |
3780 | +Traceback (most recent call last): |
3781 | + ... |
3782 | +AssertionError: my error |
3783 | + |
3784 | +bzr ... on python ... |
3785 | +arguments: ... |
3786 | +plugins: fake_plugin[1.2.3] |
3787 | +encoding: ... |
3788 | + |
3789 | +*** Bazaar has encountered an internal error. This probably indicates a |
3790 | + bug in Bazaar. You can help us fix it by filing a bug report at |
3791 | + https://bugs.launchpad.net/bzr/+filebug |
3792 | + including this traceback and a description of the problem. |
3793 | +""", flags=doctest.ELLIPSIS|doctest.REPORT_UDIFF)) |
3794 | |
3795 | === modified file 'bzrlib/tests/test_diff.py' |
3796 | --- bzrlib/tests/test_diff.py 2011-01-21 22:08:19 +0000 |
3797 | +++ bzrlib/tests/test_diff.py 2011-07-14 21:01:48 +0000 |
3798 | @@ -226,7 +226,7 @@ |
3799 | output = StringIO.StringIO() |
3800 | diff.internal_diff(u'old_\xb5', ['old_text\n'], |
3801 | u'new_\xe5', ['new_text\n'], output) |
3802 | - self.failUnless(isinstance(output.getvalue(), str), |
3803 | + self.assertIsInstance(output.getvalue(), str, |
3804 | 'internal_diff should return bytestrings') |
3805 | |
3806 | |
3807 | |
3808 | === modified file 'bzrlib/tests/test_export.py' |
3809 | --- bzrlib/tests/test_export.py 2010-09-20 11:30:28 +0000 |
3810 | +++ bzrlib/tests/test_export.py 2011-07-14 21:01:48 +0000 |
3811 | @@ -32,8 +32,8 @@ |
3812 | wt.add(['a', 'a/b', 'a/c']) |
3813 | os.unlink('a/c') |
3814 | export.export(wt, 'target', format="dir") |
3815 | - self.failUnlessExists('target/a/b') |
3816 | - self.failIfExists('target/a/c') |
3817 | + self.assertPathExists('target/a/b') |
3818 | + self.assertPathDoesNotExist('target/a/c') |
3819 | |
3820 | def test_dir_export_symlink(self): |
3821 | self.requireFeature(tests.SymlinkFeature) |
3822 | @@ -41,7 +41,7 @@ |
3823 | os.symlink('source', 'link') |
3824 | wt.add(['link']) |
3825 | export.export(wt, 'target', format="dir") |
3826 | - self.failUnlessExists('target/link') |
3827 | + self.assertPathExists('target/link') |
3828 | |
3829 | def test_dir_export_to_existing_empty_dir_success(self): |
3830 | self.build_tree(['source/', 'source/a', 'source/b/', 'source/b/c']) |
3831 | @@ -50,9 +50,9 @@ |
3832 | wt.commit('1') |
3833 | self.build_tree(['target/']) |
3834 | export.export(wt, 'target', format="dir") |
3835 | - self.failUnlessExists('target/a') |
3836 | - self.failUnlessExists('target/b') |
3837 | - self.failUnlessExists('target/b/c') |
3838 | + self.assertPathExists('target/a') |
3839 | + self.assertPathExists('target/b') |
3840 | + self.assertPathExists('target/b/c') |
3841 | |
3842 | def test_dir_export_to_existing_nonempty_dir_fail(self): |
3843 | self.build_tree(['source/', 'source/a', 'source/b/', 'source/b/c']) |
3844 | @@ -68,10 +68,10 @@ |
3845 | wtree.add(['dir2', 'first', 'dir2/second']) |
3846 | wtree.commit('1') |
3847 | export.export(wtree, 'target1', format='dir', subdir='first') |
3848 | - self.failUnlessExists('target1/first') |
3849 | + self.assertPathExists('target1/first') |
3850 | export.export(wtree, 'target2', format='dir', subdir='dir2/second') |
3851 | - self.failUnlessExists('target2/second') |
3852 | - |
3853 | + self.assertPathExists('target2/second') |
3854 | + |
3855 | def test_dir_export_files_same_timestamp(self): |
3856 | builder = self.make_branch_builder('source') |
3857 | builder.start_series() |
3858 | |
3859 | === modified file 'bzrlib/tests/test_ftp_transport.py' |
3860 | --- bzrlib/tests/test_ftp_transport.py 2011-01-21 22:08:19 +0000 |
3861 | +++ bzrlib/tests/test_ftp_transport.py 2011-07-14 21:01:48 +0000 |
3862 | @@ -44,9 +44,9 @@ |
3863 | |
3864 | def test_aftp_degrade(self): |
3865 | t = transport.get_transport('aftp://host/path') |
3866 | - self.failUnless(t.is_active) |
3867 | + self.assertTrue(t.is_active) |
3868 | parent = t.clone('..') |
3869 | - self.failUnless(parent.is_active) |
3870 | + self.assertTrue(parent.is_active) |
3871 | |
3872 | self.assertEqual('aftp://host/path', t.abspath('')) |
3873 | |
3874 | |
3875 | === modified file 'bzrlib/tests/test_generate_ids.py' |
3876 | --- bzrlib/tests/test_generate_ids.py 2011-01-21 22:08:19 +0000 |
3877 | +++ bzrlib/tests/test_generate_ids.py 2011-07-14 21:01:48 +0000 |
3878 | @@ -62,13 +62,13 @@ |
3879 | # Test both case squashing and length restriction |
3880 | fid = gen_file_id('A'*50 + '.txt') |
3881 | self.assertStartsWith(fid, 'a'*20 + '-') |
3882 | - self.failUnless(len(fid) < 60) |
3883 | + self.assertTrue(len(fid) < 60) |
3884 | |
3885 | # restricting length happens after the other actions, so |
3886 | # we preserve as much as possible |
3887 | fid = gen_file_id('\xe5\xb5..aBcd\tefGhijKLMnop\tqrstuvwxyz') |
3888 | self.assertStartsWith(fid, 'abcdefghijklmnopqrst-') |
3889 | - self.failUnless(len(fid) < 60) |
3890 | + self.assertTrue(len(fid) < 60) |
3891 | |
3892 | def test_file_ids_are_ascii(self): |
3893 | tail = r'-\d{14}-[a-z0-9]{16}-\d+' |
3894 | |
3895 | === modified file 'bzrlib/tests/test_globbing.py' |
3896 | --- bzrlib/tests/test_globbing.py 2011-01-21 22:08:19 +0000 |
3897 | +++ bzrlib/tests/test_globbing.py 2011-07-14 21:01:48 +0000 |
3898 | @@ -37,11 +37,11 @@ |
3899 | glob = glob_prefix + glob |
3900 | globster = Globster([glob]) |
3901 | for name in positive: |
3902 | - self.failUnless(globster.match(name), repr( |
3903 | + self.assertTrue(globster.match(name), repr( |
3904 | u'name "%s" does not match glob "%s" (re=%s)' % |
3905 | (name, glob, globster._regex_patterns[0][0].pattern))) |
3906 | for name in negative: |
3907 | - self.failIf(globster.match(name), repr( |
3908 | + self.assertFalse(globster.match(name), repr( |
3909 | u'name "%s" does match glob "%s" (re=%s)' % |
3910 | (name, glob, globster._regex_patterns[0][0].pattern))) |
3911 | |
3912 | |
3913 | === modified file 'bzrlib/tests/test_ignores.py' |
3914 | --- bzrlib/tests/test_ignores.py 2011-01-21 22:08:19 +0000 |
3915 | +++ bzrlib/tests/test_ignores.py 2011-07-14 21:01:48 +0000 |
3916 | @@ -76,11 +76,11 @@ |
3917 | def test_create_if_missing(self): |
3918 | # $HOME should be set to '.' |
3919 | ignore_path = config.user_ignore_config_filename() |
3920 | - self.failIfExists(ignore_path) |
3921 | + self.assertPathDoesNotExist(ignore_path) |
3922 | user_ignores = ignores.get_user_ignores() |
3923 | self.assertEqual(set(ignores.USER_DEFAULTS), user_ignores) |
3924 | |
3925 | - self.failUnlessExists(ignore_path) |
3926 | + self.assertPathExists(ignore_path) |
3927 | f = open(ignore_path, 'rb') |
3928 | try: |
3929 | entries = ignores.parse_ignore_file(f) |
3930 | |
3931 | === modified file 'bzrlib/tests/test_inv.py' |
3932 | --- bzrlib/tests/test_inv.py 2011-01-21 22:08:19 +0000 |
3933 | +++ bzrlib/tests/test_inv.py 2011-07-14 21:01:48 +0000 |
3934 | @@ -650,15 +650,15 @@ |
3935 | |
3936 | def test_file_has_text(self): |
3937 | file = inventory.InventoryFile('123', 'hello.c', ROOT_ID) |
3938 | - self.failUnless(file.has_text()) |
3939 | + self.assertTrue(file.has_text()) |
3940 | |
3941 | def test_directory_has_text(self): |
3942 | dir = inventory.InventoryDirectory('123', 'hello.c', ROOT_ID) |
3943 | - self.failIf(dir.has_text()) |
3944 | + self.assertFalse(dir.has_text()) |
3945 | |
3946 | def test_link_has_text(self): |
3947 | link = inventory.InventoryLink('123', 'hello.c', ROOT_ID) |
3948 | - self.failIf(link.has_text()) |
3949 | + self.assertFalse(link.has_text()) |
3950 | |
3951 | def test_make_entry(self): |
3952 | self.assertIsInstance(inventory.make_entry("file", "name", ROOT_ID), |
3953 | @@ -1219,6 +1219,88 @@ |
3954 | self.assertEqual(('tree\xce\xa9name', 'tree-root-id', 'tree-rev-id'), |
3955 | inv._bytes_to_utf8name_key(bytes)) |
3956 | |
3957 | + def make_basic_utf8_inventory(self): |
3958 | + inv = Inventory() |
3959 | + inv.revision_id = "revid" |
3960 | + inv.root.revision = "rootrev" |
3961 | + root_id = inv.root.file_id |
3962 | + inv.add(InventoryFile("fileid", u'f\xefle', root_id)) |
3963 | + inv["fileid"].revision = "filerev" |
3964 | + inv["fileid"].text_sha1 = "ffff" |
3965 | + inv["fileid"].text_size = 0 |
3966 | + inv.add(InventoryDirectory("dirid", u'dir-\N{EURO SIGN}', root_id)) |
3967 | + inv.add(InventoryFile("childid", u'ch\xefld', "dirid")) |
3968 | + inv["childid"].revision = "filerev" |
3969 | + inv["childid"].text_sha1 = "ffff" |
3970 | + inv["childid"].text_size = 0 |
3971 | + chk_bytes = self.get_chk_bytes() |
3972 | + chk_inv = CHKInventory.from_inventory(chk_bytes, inv) |
3973 | + bytes = ''.join(chk_inv.to_lines()) |
3974 | + return CHKInventory.deserialise(chk_bytes, bytes, ("revid",)) |
3975 | + |
3976 | + def test__preload_handles_utf8(self): |
3977 | + new_inv = self.make_basic_utf8_inventory() |
3978 | + self.assertEqual({}, new_inv._fileid_to_entry_cache) |
3979 | + self.assertFalse(new_inv._fully_cached) |
3980 | + new_inv._preload_cache() |
3981 | + self.assertEqual( |
3982 | + sorted([new_inv.root_id, "fileid", "dirid", "childid"]), |
3983 | + sorted(new_inv._fileid_to_entry_cache.keys())) |
3984 | + ie_root = new_inv._fileid_to_entry_cache[new_inv.root_id] |
3985 | + self.assertEqual([u'dir-\N{EURO SIGN}', u'f\xefle'], |
3986 | + sorted(ie_root._children.keys())) |
3987 | + ie_dir = new_inv._fileid_to_entry_cache['dirid'] |
3988 | + self.assertEqual([u'ch\xefld'], sorted(ie_dir._children.keys())) |
3989 | + |
3990 | + def test__preload_populates_cache(self): |
3991 | + inv = Inventory() |
3992 | + inv.revision_id = "revid" |
3993 | + inv.root.revision = "rootrev" |
3994 | + root_id = inv.root.file_id |
3995 | + inv.add(InventoryFile("fileid", "file", root_id)) |
3996 | + inv["fileid"].revision = "filerev" |
3997 | + inv["fileid"].executable = True |
3998 | + inv["fileid"].text_sha1 = "ffff" |
3999 | + inv["fileid"].text_size = 1 |
4000 | + inv.add(InventoryDirectory("dirid", "dir", root_id)) |
4001 | + inv.add(InventoryFile("childid", "child", "dirid")) |
4002 | + inv["childid"].revision = "filerev" |
4003 | + inv["childid"].executable = False |
4004 | + inv["childid"].text_sha1 = "dddd" |
4005 | + inv["childid"].text_size = 1 |
4006 | + chk_bytes = self.get_chk_bytes() |
4007 | + chk_inv = CHKInventory.from_inventory(chk_bytes, inv) |
4008 | + bytes = ''.join(chk_inv.to_lines()) |
4009 | + new_inv = CHKInventory.deserialise(chk_bytes, bytes, ("revid",)) |
4010 | + self.assertEqual({}, new_inv._fileid_to_entry_cache) |
4011 | + self.assertFalse(new_inv._fully_cached) |
4012 | + new_inv._preload_cache() |
4013 | + self.assertEqual( |
4014 | + sorted([root_id, "fileid", "dirid", "childid"]), |
4015 | + sorted(new_inv._fileid_to_entry_cache.keys())) |
4016 | + self.assertTrue(new_inv._fully_cached) |
4017 | + ie_root = new_inv._fileid_to_entry_cache[root_id] |
4018 | + self.assertEqual(['dir', 'file'], sorted(ie_root._children.keys())) |
4019 | + ie_dir = new_inv._fileid_to_entry_cache['dirid'] |
4020 | + self.assertEqual(['child'], sorted(ie_dir._children.keys())) |
4021 | + |
4022 | + def test__preload_handles_partially_evaluated_inventory(self): |
4023 | + new_inv = self.make_basic_utf8_inventory() |
4024 | + ie = new_inv[new_inv.root_id] |
4025 | + self.assertIs(None, ie._children) |
4026 | + self.assertEqual([u'dir-\N{EURO SIGN}', u'f\xefle'], |
4027 | + sorted(ie.children.keys())) |
4028 | + # Accessing .children loads _children |
4029 | + self.assertEqual([u'dir-\N{EURO SIGN}', u'f\xefle'], |
4030 | + sorted(ie._children.keys())) |
4031 | + new_inv._preload_cache() |
4032 | + # No change |
4033 | + self.assertEqual([u'dir-\N{EURO SIGN}', u'f\xefle'], |
4034 | + sorted(ie._children.keys())) |
4035 | + ie_dir = new_inv["dirid"] |
4036 | + self.assertEqual([u'ch\xefld'], |
4037 | + sorted(ie_dir._children.keys())) |
4038 | + |
4039 | |
4040 | class TestCHKInventoryExpand(tests.TestCaseWithMemoryTransport): |
4041 | |
4042 | |
4043 | === modified file 'bzrlib/tests/test_lazy_import.py' |
4044 | --- bzrlib/tests/test_lazy_import.py 2011-01-21 22:08:19 +0000 |
4045 | +++ bzrlib/tests/test_lazy_import.py 2011-07-14 21:01:48 +0000 |
4046 | @@ -265,7 +265,7 @@ |
4047 | InstrumentedReplacer(scope=globals(), name='test_class2', |
4048 | factory=factory) |
4049 | |
4050 | - self.failIf(test_class2 is TestClass) |
4051 | + self.assertFalse(test_class2 is TestClass) |
4052 | obj = test_class2() |
4053 | self.assertIs(test_class2, TestClass) |
4054 | self.assertIsInstance(obj, TestClass) |
4055 | @@ -298,7 +298,7 @@ |
4056 | InstrumentedReplacer(scope=globals(), name='test_func1', |
4057 | factory=factory) |
4058 | |
4059 | - self.failIf(test_func1 is func) |
4060 | + self.assertFalse(test_func1 is func) |
4061 | val = test_func1(1, 2, c='3') |
4062 | self.assertIs(test_func1, func) |
4063 | |
4064 | |
4065 | === modified file 'bzrlib/tests/test_lazy_regex.py' |
4066 | --- bzrlib/tests/test_lazy_regex.py 2010-09-20 11:30:28 +0000 |
4067 | +++ bzrlib/tests/test_lazy_regex.py 2011-07-14 21:01:48 +0000 |
4068 | @@ -130,7 +130,7 @@ |
4069 | lazy_regex.install_lazy_compile() |
4070 | lazy_regex.reset_compile() |
4071 | pattern = re.compile('foo') |
4072 | - self.failIf(isinstance(pattern, lazy_regex.LazyRegex), |
4073 | + self.assertFalse(isinstance(pattern, lazy_regex.LazyRegex), |
4074 | 'lazy_regex.reset_compile() did not restore the original' |
4075 | ' compile() function %s' % (type(pattern),)) |
4076 | # but the returned object should still support regex operations |
4077 | |
4078 | === modified file 'bzrlib/tests/test_lockdir.py' |
4079 | --- bzrlib/tests/test_lockdir.py 2011-01-21 22:08:19 +0000 |
4080 | +++ bzrlib/tests/test_lockdir.py 2011-07-14 21:01:48 +0000 |
4081 | @@ -628,18 +628,18 @@ |
4082 | lf1 = LockDir(t, 'test_lock') |
4083 | |
4084 | lf1.create() |
4085 | - self.failUnless(t.has('test_lock')) |
4086 | + self.assertTrue(t.has('test_lock')) |
4087 | |
4088 | t.rmdir('test_lock') |
4089 | - self.failIf(t.has('test_lock')) |
4090 | + self.assertFalse(t.has('test_lock')) |
4091 | |
4092 | # This will create 'test_lock' if it needs to |
4093 | lf1.lock_write() |
4094 | - self.failUnless(t.has('test_lock')) |
4095 | - self.failUnless(t.has('test_lock/held/info')) |
4096 | + self.assertTrue(t.has('test_lock')) |
4097 | + self.assertTrue(t.has('test_lock/held/info')) |
4098 | |
4099 | lf1.unlock() |
4100 | - self.failIf(t.has('test_lock/held/info')) |
4101 | + self.assertFalse(t.has('test_lock/held/info')) |
4102 | |
4103 | def test__format_lock_info(self): |
4104 | ld1 = self.get_lock() |
4105 | |
4106 | === modified file 'bzrlib/tests/test_lru_cache.py' |
4107 | --- bzrlib/tests/test_lru_cache.py 2010-09-20 11:30:28 +0000 |
4108 | +++ bzrlib/tests/test_lru_cache.py 2011-07-14 21:01:48 +0000 |
4109 | @@ -38,18 +38,18 @@ |
4110 | def test_missing(self): |
4111 | cache = lru_cache.LRUCache(max_cache=10) |
4112 | |
4113 | - self.failIf('foo' in cache) |
4114 | + self.assertFalse('foo' in cache) |
4115 | self.assertRaises(KeyError, cache.__getitem__, 'foo') |
4116 | |
4117 | cache['foo'] = 'bar' |
4118 | self.assertEqual('bar', cache['foo']) |
4119 | - self.failUnless('foo' in cache) |
4120 | - self.failIf('bar' in cache) |
4121 | + self.assertTrue('foo' in cache) |
4122 | + self.assertFalse('bar' in cache) |
4123 | |
4124 | def test_map_None(self): |
4125 | # Make sure that we can properly map None as a key. |
4126 | cache = lru_cache.LRUCache(max_cache=10) |
4127 | - self.failIf(None in cache) |
4128 | + self.assertFalse(None in cache) |
4129 | cache[None] = 1 |
4130 | self.assertEqual(1, cache[None]) |
4131 | cache[None] = 2 |
4132 | @@ -75,8 +75,8 @@ |
4133 | # With a max cache of 1, adding 'baz' should pop out 'foo' |
4134 | cache['baz'] = 'biz' |
4135 | |
4136 | - self.failIf('foo' in cache) |
4137 | - self.failUnless('baz' in cache) |
4138 | + self.assertFalse('foo' in cache) |
4139 | + self.assertTrue('baz' in cache) |
4140 | |
4141 | self.assertEqual('biz', cache['baz']) |
4142 | |
4143 | @@ -92,7 +92,7 @@ |
4144 | # This must kick out 'foo' because it was the last accessed |
4145 | cache['nub'] = 'in' |
4146 | |
4147 | - self.failIf('foo' in cache) |
4148 | + self.assertFalse('foo' in cache) |
4149 | |
4150 | def test_cleanup(self): |
4151 | """Test that we can use a cleanup function.""" |
4152 | |
4153 | === modified file 'bzrlib/tests/test_merge.py' |
4154 | --- bzrlib/tests/test_merge.py 2011-01-21 22:08:19 +0000 |
4155 | +++ bzrlib/tests/test_merge.py 2011-07-14 21:01:48 +0000 |
4156 | @@ -90,8 +90,8 @@ |
4157 | os.chdir('branch2') |
4158 | self.run_bzr('merge ../branch1/baz', retcode=3) |
4159 | self.run_bzr('merge ../branch1/foo') |
4160 | - self.failUnlessExists('foo') |
4161 | - self.failIfExists('bar') |
4162 | + self.assertPathExists('foo') |
4163 | + self.assertPathDoesNotExist('bar') |
4164 | wt2 = WorkingTree.open('.') # opens branch2 |
4165 | self.assertEqual([tip], wt2.get_parent_ids()) |
4166 | |
4167 | @@ -157,12 +157,12 @@ |
4168 | log = StringIO() |
4169 | merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(), |
4170 | this_tree=tree_b, ignore_zero=True) |
4171 | - self.failUnless('All changes applied successfully.\n' not in |
4172 | + self.assertTrue('All changes applied successfully.\n' not in |
4173 | self.get_log()) |
4174 | tree_b.revert() |
4175 | merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(), |
4176 | this_tree=tree_b, ignore_zero=False) |
4177 | - self.failUnless('All changes applied successfully.\n' in self.get_log()) |
4178 | + self.assertTrue('All changes applied successfully.\n' in self.get_log()) |
4179 | |
4180 | def test_merge_inner_conflicts(self): |
4181 | tree_a = self.make_branch_and_tree('a') |
4182 | |
4183 | === modified file 'bzrlib/tests/test_merge_core.py' |
4184 | --- bzrlib/tests/test_merge_core.py 2011-01-21 22:08:19 +0000 |
4185 | +++ bzrlib/tests/test_merge_core.py 2011-07-14 21:01:48 +0000 |
4186 | @@ -493,16 +493,16 @@ |
4187 | wtb = d_b.open_workingtree() |
4188 | wtb.commit('this revision', allow_pointless=False) |
4189 | self.assertEqual(1, wtb.merge_from_branch(wta.branch)) |
4190 | - self.failUnlessExists('b/file.THIS') |
4191 | - self.failUnlessExists('b/file.BASE') |
4192 | - self.failUnlessExists('b/file.OTHER') |
4193 | + self.assertPathExists('b/file.THIS') |
4194 | + self.assertPathExists('b/file.BASE') |
4195 | + self.assertPathExists('b/file.OTHER') |
4196 | wtb.revert() |
4197 | self.assertEqual(1, wtb.merge_from_branch(wta.branch, |
4198 | merge_type=WeaveMerger)) |
4199 | - self.failUnlessExists('b/file') |
4200 | - self.failUnlessExists('b/file.THIS') |
4201 | - self.failUnlessExists('b/file.BASE') |
4202 | - self.failUnlessExists('b/file.OTHER') |
4203 | + self.assertPathExists('b/file') |
4204 | + self.assertPathExists('b/file.THIS') |
4205 | + self.assertPathExists('b/file.BASE') |
4206 | + self.assertPathExists('b/file.OTHER') |
4207 | |
4208 | def test_weave_conflicts_not_in_base(self): |
4209 | builder = self.make_branch_builder('source') |
4210 | @@ -532,11 +532,11 @@ |
4211 | self.assertEqual(1, tree.merge_from_branch(tree.branch, |
4212 | to_revision='D-id', |
4213 | merge_type=WeaveMerger)) |
4214 | - self.failUnlessExists('tree/foo.THIS') |
4215 | - self.failUnlessExists('tree/foo.OTHER') |
4216 | + self.assertPathExists('tree/foo.THIS') |
4217 | + self.assertPathExists('tree/foo.OTHER') |
4218 | self.expectFailure('fail to create .BASE in some criss-cross merges', |
4219 | - self.failUnlessExists, 'tree/foo.BASE') |
4220 | - self.failUnlessExists('tree/foo.BASE') |
4221 | + self.assertPathExists, 'tree/foo.BASE') |
4222 | + self.assertPathExists('tree/foo.BASE') |
4223 | |
4224 | def test_merge_unrelated(self): |
4225 | """Sucessfully merges unrelated branches with no common names""" |
4226 | @@ -584,7 +584,7 @@ |
4227 | wtb.commit('changed file', allow_pointless=False) |
4228 | wtb.merge_from_branch(wta.branch, wta.branch.last_revision(), |
4229 | wta.branch.get_rev_id(1)) |
4230 | - self.failIf(os.path.lexists('b/file')) |
4231 | + self.assertFalse(os.path.lexists('b/file')) |
4232 | |
4233 | def test_merge_metadata_vs_deletion(self): |
4234 | """Conflict deletion vs metadata change""" |
4235 | @@ -618,8 +618,8 @@ |
4236 | b_wt.commit('r1', rev_id='r1') |
4237 | self.assertEqual(0, a_wt.merge_from_branch(b_wt.branch, |
4238 | b_wt.branch.last_revision(), b_wt.branch.get_rev_id(1))) |
4239 | - self.failUnlessExists('a/un') |
4240 | - self.failUnless('a/deux') |
4241 | + self.assertPathExists('a/un') |
4242 | + self.assertTrue('a/deux') |
4243 | self.assertFalse(os.path.exists('a/tmp')) |
4244 | self.assertEqual(file('a/un').read(),'DEUX') |
4245 | self.assertEqual(file('a/deux').read(),'UN') |
4246 | |
4247 | === modified file 'bzrlib/tests/test_multiparent.py' |
4248 | --- bzrlib/tests/test_multiparent.py 2011-01-21 22:08:19 +0000 |
4249 | +++ bzrlib/tests/test_multiparent.py 2011-07-14 21:01:48 +0000 |
4250 | @@ -265,10 +265,10 @@ |
4251 | def test_filenames(self): |
4252 | vf = multiparent.MultiVersionedFile('foop') |
4253 | vf.add_version('a\nb\nc\nd'.splitlines(True), 'a', []) |
4254 | - self.failUnlessExists('foop.mpknit') |
4255 | - self.failIfExists('foop.mpidx') |
4256 | + self.assertPathExists('foop.mpknit') |
4257 | + self.assertPathDoesNotExist('foop.mpidx') |
4258 | vf.save() |
4259 | - self.failUnlessExists('foop.mpidx') |
4260 | + self.assertPathExists('foop.mpidx') |
4261 | vf.destroy() |
4262 | - self.failIfExists('foop.mpknit') |
4263 | - self.failIfExists('foop.mpidx') |
4264 | + self.assertPathDoesNotExist('foop.mpknit') |
4265 | + self.assertPathDoesNotExist('foop.mpidx') |
4266 | |
4267 | === modified file 'bzrlib/tests/test_osutils.py' |
4268 | --- bzrlib/tests/test_osutils.py 2011-01-21 22:08:19 +0000 |
4269 | +++ bzrlib/tests/test_osutils.py 2011-07-14 21:01:48 +0000 |
4270 | @@ -103,18 +103,18 @@ |
4271 | class TestContainsWhitespace(tests.TestCase): |
4272 | |
4273 | def test_contains_whitespace(self): |
4274 | - self.failUnless(osutils.contains_whitespace(u' ')) |
4275 | - self.failUnless(osutils.contains_whitespace(u'hello there')) |
4276 | - self.failUnless(osutils.contains_whitespace(u'hellothere\n')) |
4277 | - self.failUnless(osutils.contains_whitespace(u'hello\nthere')) |
4278 | - self.failUnless(osutils.contains_whitespace(u'hello\rthere')) |
4279 | - self.failUnless(osutils.contains_whitespace(u'hello\tthere')) |
4280 | + self.assertTrue(osutils.contains_whitespace(u' ')) |
4281 | + self.assertTrue(osutils.contains_whitespace(u'hello there')) |
4282 | + self.assertTrue(osutils.contains_whitespace(u'hellothere\n')) |
4283 | + self.assertTrue(osutils.contains_whitespace(u'hello\nthere')) |
4284 | + self.assertTrue(osutils.contains_whitespace(u'hello\rthere')) |
4285 | + self.assertTrue(osutils.contains_whitespace(u'hello\tthere')) |
4286 | |
4287 | # \xa0 is "Non-breaking-space" which on some python locales thinks it |
4288 | # is whitespace, but we do not. |
4289 | - self.failIf(osutils.contains_whitespace(u'')) |
4290 | - self.failIf(osutils.contains_whitespace(u'hellothere')) |
4291 | - self.failIf(osutils.contains_whitespace(u'hello\xa0there')) |
4292 | + self.assertFalse(osutils.contains_whitespace(u'')) |
4293 | + self.assertFalse(osutils.contains_whitespace(u'hellothere')) |
4294 | + self.assertFalse(osutils.contains_whitespace(u'hello\xa0there')) |
4295 | |
4296 | |
4297 | class TestRename(tests.TestCaseInTempDir): |
4298 | @@ -134,8 +134,8 @@ |
4299 | # This should work everywhere |
4300 | self.create_file('a', 'something in a\n') |
4301 | self._fancy_rename('a', 'b') |
4302 | - self.failIfExists('a') |
4303 | - self.failUnlessExists('b') |
4304 | + self.assertPathDoesNotExist('a') |
4305 | + self.assertPathExists('b') |
4306 | self.check_file_contents('b', 'something in a\n') |
4307 | |
4308 | self.create_file('a', 'new something in a\n') |
4309 | @@ -148,7 +148,7 @@ |
4310 | self.create_file('target', 'data in target\n') |
4311 | self.assertRaises((IOError, OSError), self._fancy_rename, |
4312 | 'missingsource', 'target') |
4313 | - self.failUnlessExists('target') |
4314 | + self.assertPathExists('target') |
4315 | self.check_file_contents('target', 'data in target\n') |
4316 | |
4317 | def test_fancy_rename_fails_if_source_and_target_missing(self): |
4318 | @@ -159,8 +159,8 @@ |
4319 | # Rename should be semi-atomic on all platforms |
4320 | self.create_file('a', 'something in a\n') |
4321 | osutils.rename('a', 'b') |
4322 | - self.failIfExists('a') |
4323 | - self.failUnlessExists('b') |
4324 | + self.assertPathDoesNotExist('a') |
4325 | + self.assertPathExists('b') |
4326 | self.check_file_contents('b', 'something in a\n') |
4327 | |
4328 | self.create_file('a', 'new something in a\n') |
4329 | @@ -248,8 +248,8 @@ |
4330 | |
4331 | osutils.rmtree('dir') |
4332 | |
4333 | - self.failIfExists('dir/file') |
4334 | - self.failIfExists('dir') |
4335 | + self.assertPathDoesNotExist('dir/file') |
4336 | + self.assertPathDoesNotExist('dir') |
4337 | |
4338 | |
4339 | class TestDeleteAny(tests.TestCaseInTempDir): |
4340 | @@ -469,13 +469,13 @@ |
4341 | f = file('MixedCaseName', 'w') |
4342 | f.close() |
4343 | actual = osutils.canonical_relpath(self.test_base_dir, 'mixedcasename') |
4344 | - self.failUnlessEqual('work/MixedCaseName', actual) |
4345 | + self.assertEqual('work/MixedCaseName', actual) |
4346 | |
4347 | def test_canonical_relpath_missing_tail(self): |
4348 | os.mkdir('MixedCaseParent') |
4349 | actual = osutils.canonical_relpath(self.test_base_dir, |
4350 | 'mixedcaseparent/nochild') |
4351 | - self.failUnlessEqual('work/MixedCaseParent/nochild', actual) |
4352 | + self.assertEqual('work/MixedCaseParent/nochild', actual) |
4353 | |
4354 | |
4355 | class Test_CICPCanonicalRelpath(tests.TestCaseWithTransport): |
4356 | @@ -905,8 +905,8 @@ |
4357 | b.close() |
4358 | |
4359 | osutils._win32_rename('b', 'a') |
4360 | - self.failUnlessExists('a') |
4361 | - self.failIfExists('b') |
4362 | + self.assertPathExists('a') |
4363 | + self.assertPathDoesNotExist('b') |
4364 | self.assertFileEqual('baz\n', 'a') |
4365 | |
4366 | def test_rename_missing_file(self): |
4367 | @@ -1595,7 +1595,7 @@ |
4368 | ('d', 'source/b', 'target/b'), |
4369 | ('f', 'source/b/c', 'target/b/c'), |
4370 | ], processed_files) |
4371 | - self.failIfExists('target') |
4372 | + self.assertPathDoesNotExist('target') |
4373 | if osutils.has_symlinks(): |
4374 | self.assertEqual([('source/lnk', 'target/lnk')], processed_links) |
4375 | |
4376 | @@ -1647,7 +1647,7 @@ |
4377 | old = osutils.set_or_unset_env('BZR_TEST_ENV_VAR', None) |
4378 | self.assertEqual('foo', old) |
4379 | self.assertEqual(None, os.environ.get('BZR_TEST_ENV_VAR')) |
4380 | - self.failIf('BZR_TEST_ENV_VAR' in os.environ) |
4381 | + self.assertFalse('BZR_TEST_ENV_VAR' in os.environ) |
4382 | |
4383 | |
4384 | class TestSizeShaFile(tests.TestCaseInTempDir): |
4385 | @@ -2036,6 +2036,7 @@ |
4386 | # Whatever the result is, if we don't raise an exception, it's ok. |
4387 | osutils.terminal_width() |
4388 | |
4389 | + |
4390 | class TestCreationOps(tests.TestCaseInTempDir): |
4391 | _test_needs_features = [features.chown_feature] |
4392 | |
4393 | @@ -2071,6 +2072,7 @@ |
4394 | self.assertEquals(self.uid, s.st_uid) |
4395 | self.assertEquals(self.gid, s.st_gid) |
4396 | |
4397 | + |
4398 | class TestGetuserUnicode(tests.TestCase): |
4399 | |
4400 | def test_ascii_user(self): |
4401 | @@ -2091,6 +2093,13 @@ |
4402 | self.overrideEnv('LOGNAME', u'jrandom\xb6'.encode(ue)) |
4403 | self.assertEqual(u'jrandom\xb6', osutils.getuser_unicode()) |
4404 | |
4405 | + def test_no_username_bug_660174(self): |
4406 | + self.requireFeature(features.win32_feature) |
4407 | + for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): |
4408 | + self.overrideEnv(name, None) |
4409 | + self.assertEqual(u'UNKNOWN', osutils.getuser_unicode()) |
4410 | + |
4411 | + |
4412 | class TestBackupNames(tests.TestCase): |
4413 | |
4414 | def setUp(self): |
4415 | |
4416 | === modified file 'bzrlib/tests/test_plugins.py' |
4417 | --- bzrlib/tests/test_plugins.py 2011-01-21 22:08:19 +0000 |
4418 | +++ bzrlib/tests/test_plugins.py 2011-07-14 21:01:48 +0000 |
4419 | @@ -91,12 +91,12 @@ |
4420 | delattr(plugin, submodule_name) |
4421 | |
4422 | def assertPluginUnknown(self, name): |
4423 | - self.failIf(getattr(bzrlib.plugins, name, None) is not None) |
4424 | - self.failIf('bzrlib.plugins.%s' % name in sys.modules) |
4425 | + self.assertFalse(getattr(bzrlib.plugins, name, None) is not None) |
4426 | + self.assertFalse('bzrlib.plugins.%s' % name in sys.modules) |
4427 | |
4428 | def assertPluginKnown(self, name): |
4429 | - self.failUnless(getattr(bzrlib.plugins, name, None) is not None) |
4430 | - self.failUnless('bzrlib.plugins.%s' % name in sys.modules) |
4431 | + self.assertTrue(getattr(bzrlib.plugins, name, None) is not None) |
4432 | + self.assertTrue('bzrlib.plugins.%s' % name in sys.modules) |
4433 | |
4434 | |
4435 | class TestLoadingPlugins(tests.TestCaseInTempDir, TestPluginMixin): |
4436 | @@ -109,12 +109,12 @@ |
4437 | # file name we can use which is also a valid attribute for accessing in |
4438 | # activeattributes. - we cannot give import parameters. |
4439 | tempattribute = "0" |
4440 | - self.failIf(tempattribute in self.activeattributes) |
4441 | + self.assertFalse(tempattribute in self.activeattributes) |
4442 | # set a place for the plugins to record their loading, and at the same |
4443 | # time validate that the location the plugins should record to is |
4444 | # valid and correct. |
4445 | self.__class__.activeattributes [tempattribute] = [] |
4446 | - self.failUnless(tempattribute in self.activeattributes) |
4447 | + self.assertTrue(tempattribute in self.activeattributes) |
4448 | # create two plugin directories |
4449 | os.mkdir('first') |
4450 | os.mkdir('second') |
4451 | @@ -147,21 +147,21 @@ |
4452 | self.assertPluginUnknown('plugin') |
4453 | |
4454 | def test_plugins_from_different_dirs_can_demand_load(self): |
4455 | - self.failIf('bzrlib.plugins.pluginone' in sys.modules) |
4456 | - self.failIf('bzrlib.plugins.plugintwo' in sys.modules) |
4457 | + self.assertFalse('bzrlib.plugins.pluginone' in sys.modules) |
4458 | + self.assertFalse('bzrlib.plugins.plugintwo' in sys.modules) |
4459 | # This test tests that having two plugins in different |
4460 | # directories with different names allows them both to be loaded, when |
4461 | # we do a direct import statement. |
4462 | # Determine a file name we can use which is also a valid attribute |
4463 | # for accessing in activeattributes. - we cannot give import parameters. |
4464 | tempattribute = "different-dirs" |
4465 | - self.failIf(tempattribute in self.activeattributes) |
4466 | + self.assertFalse(tempattribute in self.activeattributes) |
4467 | # set a place for the plugins to record their loading, and at the same |
4468 | # time validate that the location the plugins should record to is |
4469 | # valid and correct. |
4470 | bzrlib.tests.test_plugins.TestLoadingPlugins.activeattributes \ |
4471 | [tempattribute] = [] |
4472 | - self.failUnless(tempattribute in self.activeattributes) |
4473 | + self.assertTrue(tempattribute in self.activeattributes) |
4474 | # create two plugin directories |
4475 | os.mkdir('first') |
4476 | os.mkdir('second') |
4477 | @@ -186,8 +186,8 @@ |
4478 | |
4479 | oldpath = bzrlib.plugins.__path__ |
4480 | try: |
4481 | - self.failIf('bzrlib.plugins.pluginone' in sys.modules) |
4482 | - self.failIf('bzrlib.plugins.plugintwo' in sys.modules) |
4483 | + self.assertFalse('bzrlib.plugins.pluginone' in sys.modules) |
4484 | + self.assertFalse('bzrlib.plugins.plugintwo' in sys.modules) |
4485 | bzrlib.plugins.__path__ = ['first', 'second'] |
4486 | exec "import bzrlib.plugins.pluginone" |
4487 | self.assertEqual(['first'], self.activeattributes[tempattribute]) |
4488 | @@ -208,13 +208,13 @@ |
4489 | # check the plugin is not loaded already |
4490 | self.assertPluginUnknown('ts_plugin') |
4491 | tempattribute = "trailing-slash" |
4492 | - self.failIf(tempattribute in self.activeattributes) |
4493 | + self.assertFalse(tempattribute in self.activeattributes) |
4494 | # set a place for the plugin to record its loading, and at the same |
4495 | # time validate that the location the plugin should record to is |
4496 | # valid and correct. |
4497 | bzrlib.tests.test_plugins.TestLoadingPlugins.activeattributes \ |
4498 | [tempattribute] = [] |
4499 | - self.failUnless(tempattribute in self.activeattributes) |
4500 | + self.assertTrue(tempattribute in self.activeattributes) |
4501 | # create a directory for the plugin |
4502 | os.mkdir('plugin_test') |
4503 | # write a plugin that will record when its loaded in the |
4504 | |
4505 | === modified file 'bzrlib/tests/test_registry.py' |
4506 | --- bzrlib/tests/test_registry.py 2011-01-21 22:08:19 +0000 |
4507 | +++ bzrlib/tests/test_registry.py 2011-07-14 21:01:48 +0000 |
4508 | @@ -39,7 +39,7 @@ |
4509 | a_registry = registry.Registry() |
4510 | self.register_stuff(a_registry) |
4511 | |
4512 | - self.failUnless(a_registry.default_key is None) |
4513 | + self.assertTrue(a_registry.default_key is None) |
4514 | |
4515 | # test get() (self.default_key is None) |
4516 | self.assertRaises(KeyError, a_registry.get) |
4517 | @@ -49,7 +49,7 @@ |
4518 | |
4519 | # test _set_default_key |
4520 | a_registry.default_key = 'five' |
4521 | - self.failUnless(a_registry.default_key == 'five') |
4522 | + self.assertTrue(a_registry.default_key == 'five') |
4523 | self.assertEqual(5, a_registry.get()) |
4524 | self.assertEqual(5, a_registry.get(None)) |
4525 | # If they ask for a specific entry, they should get KeyError |
4526 | @@ -64,9 +64,9 @@ |
4527 | a_registry = registry.Registry() |
4528 | self.register_stuff(a_registry) |
4529 | |
4530 | - self.failUnless('one' in a_registry) |
4531 | + self.assertTrue('one' in a_registry) |
4532 | a_registry.remove('one') |
4533 | - self.failIf('one' in a_registry) |
4534 | + self.assertFalse('one' in a_registry) |
4535 | self.assertRaises(KeyError, a_registry.get, 'one') |
4536 | |
4537 | a_registry.register('one', 'one') |
4538 | @@ -304,7 +304,7 @@ |
4539 | self.assertEqual(['function', 'klass', 'module', 'obj'], |
4540 | sorted(a_registry.keys())) |
4541 | # The plugin should not be loaded until we grab the first object |
4542 | - self.failIf(plugin_name in sys.modules) |
4543 | + self.assertFalse(plugin_name in sys.modules) |
4544 | |
4545 | # By default the plugin won't be in the search path |
4546 | self.assertRaises(ImportError, a_registry.get, 'obj') |
4547 | @@ -314,7 +314,7 @@ |
4548 | try: |
4549 | obj = a_registry.get('obj') |
4550 | self.assertEqual('foo', obj) |
4551 | - self.failUnless(plugin_name in sys.modules) |
4552 | + self.assertTrue(plugin_name in sys.modules) |
4553 | |
4554 | # Now grab another object |
4555 | func = a_registry.get('function') |
4556 | |
4557 | === modified file 'bzrlib/tests/test_remote.py' |
4558 | --- bzrlib/tests/test_remote.py 2011-03-13 15:08:21 +0000 |
4559 | +++ bzrlib/tests/test_remote.py 2011-07-14 21:01:48 +0000 |
4560 | @@ -3216,3 +3216,23 @@ |
4561 | self.hpss_calls = [] |
4562 | remote_branch.copy_content_into(local) |
4563 | self.assertFalse('Branch.revision_history' in self.hpss_calls) |
4564 | + |
4565 | + |
4566 | +class TestUpdateBoundBranch(tests.TestCaseWithTransport): |
4567 | + |
4568 | + def test_bug_786980(self): |
4569 | + self.transport_server = test_server.SmartTCPServer_for_testing |
4570 | + wt = self.make_branch_and_tree('master') |
4571 | + checkout = wt.branch.create_checkout('checkout') |
4572 | + wt.commit('add stuff') |
4573 | + last_revid = wt.commit('even more stuff') |
4574 | + bound_location = checkout.branch.get_bound_location() |
4575 | + # For unclear reasons some users have a bound_location without a final |
4576 | + # '/', simulate that by forcing such a value |
4577 | + self.assertEndsWith(bound_location, '/') |
4578 | + new_location = bound_location.rstrip('/') |
4579 | + checkout.branch.set_bound_location(new_location) |
4580 | + # bug 786980 was raising ReadOnlyError: A write attempt was made in a |
4581 | + # read only transaction during the update() |
4582 | + checkout.update() |
4583 | + self.assertEquals(last_revid, checkout.last_revision()) |
4584 | |
4585 | === modified file 'bzrlib/tests/test_repository.py' |
4586 | --- bzrlib/tests/test_repository.py 2011-03-13 15:08:21 +0000 |
4587 | +++ bzrlib/tests/test_repository.py 2011-07-14 21:01:48 +0000 |
4588 | @@ -128,7 +128,7 @@ |
4589 | format.initialize(dir) |
4590 | t = transport.get_transport(url) |
4591 | found_format = repository.RepositoryFormat.find_format(dir) |
4592 | - self.failUnless(isinstance(found_format, format.__class__)) |
4593 | + self.assertIsInstance(found_format, format.__class__) |
4594 | check_format(weaverepo.RepositoryFormat7(), "bar") |
4595 | |
4596 | def test_find_format_no_repository(self): |
4597 | |
4598 | === modified file 'bzrlib/tests/test_revert.py' |
4599 | --- bzrlib/tests/test_revert.py 2010-01-25 19:53:02 +0000 |
4600 | +++ bzrlib/tests/test_revert.py 2011-07-14 21:01:48 +0000 |
4601 | @@ -34,11 +34,11 @@ |
4602 | self.addCleanup(target_tree.unlock) |
4603 | merge.merge_inner(target_tree.branch, source_tree.basis_tree(), |
4604 | target_tree.basis_tree(), this_tree=target_tree) |
4605 | - self.failUnlessExists('target/dir') |
4606 | - self.failUnlessExists('target/dir/contents') |
4607 | + self.assertPathExists('target/dir') |
4608 | + self.assertPathExists('target/dir/contents') |
4609 | target_tree.revert() |
4610 | - self.failIfExists('target/dir/contents') |
4611 | - self.failIfExists('target/dir') |
4612 | + self.assertPathDoesNotExist('target/dir/contents') |
4613 | + self.assertPathDoesNotExist('target/dir') |
4614 | |
4615 | def test_revert_new(self): |
4616 | """Only locally-changed new files should be preserved when reverting |
4617 | @@ -60,26 +60,26 @@ |
4618 | tree.add('new_file') |
4619 | basis_tree = tree.branch.repository.revision_tree(tree.last_revision()) |
4620 | tree.revert() |
4621 | - self.failUnlessExists('tree/new_file') |
4622 | + self.assertPathExists('tree/new_file') |
4623 | |
4624 | # unchanged files should be deleted |
4625 | tree.add('new_file') |
4626 | tree.commit('add new_file') |
4627 | tree.revert(old_tree=basis_tree) |
4628 | - self.failIfExists('tree/new_file') |
4629 | + self.assertPathDoesNotExist('tree/new_file') |
4630 | |
4631 | # files should be deleted if their changes came from merges |
4632 | merge_target.merge_from_branch(tree.branch) |
4633 | - self.failUnlessExists('merge_target/new_file') |
4634 | + self.assertPathExists('merge_target/new_file') |
4635 | merge_target.revert() |
4636 | - self.failIfExists('merge_target/new_file') |
4637 | + self.assertPathDoesNotExist('merge_target/new_file') |
4638 | |
4639 | # files should not be deleted if changed after a merge |
4640 | merge_target.merge_from_branch(tree.branch) |
4641 | - self.failUnlessExists('merge_target/new_file') |
4642 | + self.assertPathExists('merge_target/new_file') |
4643 | self.build_tree_contents([('merge_target/new_file', 'new_contents')]) |
4644 | merge_target.revert() |
4645 | - self.failUnlessExists('merge_target/new_file') |
4646 | + self.assertPathExists('merge_target/new_file') |
4647 | |
4648 | def tree_with_executable(self): |
4649 | tree = self.make_branch_and_tree('tree') |
4650 | @@ -127,11 +127,11 @@ |
4651 | tree.commit('added file', rev_id='rev1') |
4652 | os.unlink('file') |
4653 | tree.commit('removed file') |
4654 | - self.failIfExists('file') |
4655 | + self.assertPathDoesNotExist('file') |
4656 | tree.revert(old_tree=tree.branch.repository.revision_tree('rev1')) |
4657 | - self.failUnlessExists('file') |
4658 | + self.assertPathExists('file') |
4659 | tree.revert() |
4660 | - self.failIfExists('file') |
4661 | + self.assertPathDoesNotExist('file') |
4662 | self.assertEqual({}, tree.merge_modified()) |
4663 | |
4664 | def test_empty_deprecated(self): |
4665 | @@ -154,8 +154,8 @@ |
4666 | os.rmdir('dir') |
4667 | tree.remove(['dir/', 'dir/file1', 'dir/file2']) |
4668 | tree.revert(['dir/file1']) |
4669 | - self.failUnlessExists('dir/file1') |
4670 | - self.failIfExists('dir/file2') |
4671 | + self.assertPathExists('dir/file1') |
4672 | + self.assertPathDoesNotExist('dir/file2') |
4673 | self.assertEqual('dir-id', tree.path2id('dir')) |
4674 | |
4675 | def test_revert_root_id_change(self): |
4676 | |
4677 | === modified file 'bzrlib/tests/test_revisionspec.py' |
4678 | --- bzrlib/tests/test_revisionspec.py 2011-01-21 22:08:19 +0000 |
4679 | +++ bzrlib/tests/test_revisionspec.py 2011-07-14 21:01:48 +0000 |
4680 | @@ -611,7 +611,7 @@ |
4681 | # XXX: Right now, we use fetch() to make sure the remote revisions |
4682 | # have been pulled into the local branch. We may change that |
4683 | # behavior in the future. |
4684 | - self.failUnless(self.tree.branch.repository.has_revision('new_r3')) |
4685 | + self.assertTrue(self.tree.branch.repository.has_revision('new_r3')) |
4686 | |
4687 | def test_no_commits(self): |
4688 | new_tree = self.make_branch_and_tree('new_tree') |
4689 | |
4690 | === modified file 'bzrlib/tests/test_script.py' |
4691 | --- bzrlib/tests/test_script.py 2011-01-21 22:08:19 +0000 |
4692 | +++ bzrlib/tests/test_script.py 2011-07-14 21:01:48 +0000 |
4693 | @@ -383,8 +383,8 @@ |
4694 | $ mkdir ../dir2 |
4695 | $ cd .. |
4696 | """) |
4697 | - self.failUnlessExists('dir') |
4698 | - self.failUnlessExists('dir2') |
4699 | + self.assertPathExists('dir') |
4700 | + self.assertPathExists('dir2') |
4701 | |
4702 | |
4703 | class TestCd(script.TestCaseWithTransportAndScript): |
4704 | @@ -416,7 +416,7 @@ |
4705 | $ bzr init branch |
4706 | Created a standalone tree (format: ...) |
4707 | """) |
4708 | - self.failUnlessExists('branch') |
4709 | + self.assertPathExists('branch') |
4710 | |
4711 | |
4712 | class TestEcho(script.TestCaseWithMemoryTransportAndScript): |
4713 | @@ -480,39 +480,39 @@ |
4714 | |
4715 | def test_rm_file(self): |
4716 | self.run_script('$ echo content >file') |
4717 | - self.failUnlessExists('file') |
4718 | + self.assertPathExists('file') |
4719 | self.run_script('$ rm file') |
4720 | - self.failIfExists('file') |
4721 | + self.assertPathDoesNotExist('file') |
4722 | |
4723 | def test_rm_file_force(self): |
4724 | - self.failIfExists('file') |
4725 | + self.assertPathDoesNotExist('file') |
4726 | self.run_script('$ rm -f file') |
4727 | - self.failIfExists('file') |
4728 | + self.assertPathDoesNotExist('file') |
4729 | |
4730 | def test_rm_files(self): |
4731 | self.run_script(""" |
4732 | $ echo content >file |
4733 | $ echo content >file2 |
4734 | """) |
4735 | - self.failUnlessExists('file2') |
4736 | + self.assertPathExists('file2') |
4737 | self.run_script('$ rm file file2') |
4738 | - self.failIfExists('file2') |
4739 | + self.assertPathDoesNotExist('file2') |
4740 | |
4741 | def test_rm_dir(self): |
4742 | self.run_script('$ mkdir dir') |
4743 | - self.failUnlessExists('dir') |
4744 | + self.assertPathExists('dir') |
4745 | self.run_script(""" |
4746 | $ rm dir |
4747 | 2>rm: cannot remove 'dir': Is a directory |
4748 | """) |
4749 | - self.failUnlessExists('dir') |
4750 | + self.assertPathExists('dir') |
4751 | |
4752 | def test_rm_dir_recursive(self): |
4753 | self.run_script(""" |
4754 | $ mkdir dir |
4755 | $ rm -r dir |
4756 | """) |
4757 | - self.failIfExists('dir') |
4758 | + self.assertPathDoesNotExist('dir') |
4759 | |
4760 | |
4761 | class TestMv(script.TestCaseWithTransportAndScript): |
4762 | @@ -524,10 +524,10 @@ |
4763 | |
4764 | def test_move_file(self): |
4765 | self.run_script('$ echo content >file') |
4766 | - self.failUnlessExists('file') |
4767 | + self.assertPathExists('file') |
4768 | self.run_script('$ mv file new_name') |
4769 | - self.failIfExists('file') |
4770 | - self.failUnlessExists('new_name') |
4771 | + self.assertPathDoesNotExist('file') |
4772 | + self.assertPathExists('new_name') |
4773 | |
4774 | def test_move_unknown_file(self): |
4775 | self.assertRaises(AssertionError, |
4776 | @@ -539,9 +539,9 @@ |
4777 | $ echo content >dir/file |
4778 | """) |
4779 | self.run_script('$ mv dir new_name') |
4780 | - self.failIfExists('dir') |
4781 | - self.failUnlessExists('new_name') |
4782 | - self.failUnlessExists('new_name/file') |
4783 | + self.assertPathDoesNotExist('dir') |
4784 | + self.assertPathExists('new_name') |
4785 | + self.assertPathExists('new_name/file') |
4786 | |
4787 | def test_move_file_into_dir(self): |
4788 | self.run_script(""" |
4789 | @@ -549,9 +549,9 @@ |
4790 | $ echo content > file |
4791 | """) |
4792 | self.run_script('$ mv file dir') |
4793 | - self.failUnlessExists('dir') |
4794 | - self.failIfExists('file') |
4795 | - self.failUnlessExists('dir/file') |
4796 | + self.assertPathExists('dir') |
4797 | + self.assertPathDoesNotExist('file') |
4798 | + self.assertPathExists('dir/file') |
4799 | |
4800 | |
4801 | class cmd_test_confirm(commands.Command): |
4802 | |
4803 | === modified file 'bzrlib/tests/test_selftest.py' |
4804 | --- bzrlib/tests/test_selftest.py 2011-01-21 22:08:19 +0000 |
4805 | +++ bzrlib/tests/test_selftest.py 2011-07-14 21:01:48 +0000 |
4806 | @@ -107,7 +107,7 @@ |
4807 | |
4808 | filename = u'hell\u00d8' |
4809 | self.build_tree_contents([(filename, 'contents of hello')]) |
4810 | - self.failUnlessExists(filename) |
4811 | + self.assertPathExists(filename) |
4812 | |
4813 | |
4814 | class TestClassesAvailable(tests.TestCase): |
4815 | @@ -512,6 +512,12 @@ |
4816 | self.assertRaises(AssertionError, self.assertEqualStat, |
4817 | os.lstat("foo"), os.lstat("longname")) |
4818 | |
4819 | + def test_assertPathExists(self): |
4820 | + self.assertPathExists('.') |
4821 | + self.build_tree(['foo/', 'foo/bar']) |
4822 | + self.assertPathExists('foo/bar') |
4823 | + self.assertPathDoesNotExist('foo/foo') |
4824 | + |
4825 | |
4826 | class TestTestCaseWithMemoryTransport(tests.TestCaseWithMemoryTransport): |
4827 | |
4828 | @@ -551,7 +557,7 @@ |
4829 | tree = self.make_branch_and_memory_tree('dir') |
4830 | # Guard against regression into MemoryTransport leaking |
4831 | # files to disk instead of keeping them in memory. |
4832 | - self.failIf(osutils.lexists('dir')) |
4833 | + self.assertFalse(osutils.lexists('dir')) |
4834 | self.assertIsInstance(tree, memorytree.MemoryTree) |
4835 | |
4836 | def test_make_branch_and_memory_tree_with_format(self): |
4837 | @@ -561,7 +567,7 @@ |
4838 | tree = self.make_branch_and_memory_tree('dir', format=format) |
4839 | # Guard against regression into MemoryTransport leaking |
4840 | # files to disk instead of keeping them in memory. |
4841 | - self.failIf(osutils.lexists('dir')) |
4842 | + self.assertFalse(osutils.lexists('dir')) |
4843 | self.assertIsInstance(tree, memorytree.MemoryTree) |
4844 | self.assertEqual(format.repository_format.__class__, |
4845 | tree.branch.repository._format.__class__) |
4846 | @@ -571,7 +577,7 @@ |
4847 | self.assertIsInstance(builder, branchbuilder.BranchBuilder) |
4848 | # Guard against regression into MemoryTransport leaking |
4849 | # files to disk instead of keeping them in memory. |
4850 | - self.failIf(osutils.lexists('dir')) |
4851 | + self.assertFalse(osutils.lexists('dir')) |
4852 | |
4853 | def test_make_branch_builder_with_format(self): |
4854 | # Use a repo layout that doesn't conform to a 'named' layout, to ensure |
4855 | @@ -583,7 +589,7 @@ |
4856 | the_branch = builder.get_branch() |
4857 | # Guard against regression into MemoryTransport leaking |
4858 | # files to disk instead of keeping them in memory. |
4859 | - self.failIf(osutils.lexists('dir')) |
4860 | + self.assertFalse(osutils.lexists('dir')) |
4861 | self.assertEqual(format.repository_format.__class__, |
4862 | the_branch.repository._format.__class__) |
4863 | self.assertEqual(repo_format.get_format_string(), |
4864 | @@ -595,7 +601,7 @@ |
4865 | the_branch = builder.get_branch() |
4866 | # Guard against regression into MemoryTransport leaking |
4867 | # files to disk instead of keeping them in memory. |
4868 | - self.failIf(osutils.lexists('dir')) |
4869 | + self.assertFalse(osutils.lexists('dir')) |
4870 | dir_format = bzrdir.format_registry.make_bzrdir('knit') |
4871 | self.assertEqual(dir_format.repository_format.__class__, |
4872 | the_branch.repository._format.__class__) |
4873 | @@ -634,8 +640,8 @@ |
4874 | url2 = self.get_readonly_url('foo/bar') |
4875 | t = transport.get_transport(url) |
4876 | t2 = transport.get_transport(url2) |
4877 | - self.failUnless(isinstance(t, ReadonlyTransportDecorator)) |
4878 | - self.failUnless(isinstance(t2, ReadonlyTransportDecorator)) |
4879 | + self.assertIsInstance(t, ReadonlyTransportDecorator) |
4880 | + self.assertIsInstance(t2, ReadonlyTransportDecorator) |
4881 | self.assertEqual(t2.base[:-1], t.abspath('foo/bar')) |
4882 | |
4883 | def test_get_readonly_url_http(self): |
4884 | @@ -649,8 +655,8 @@ |
4885 | # the transport returned may be any HttpTransportBase subclass |
4886 | t = transport.get_transport(url) |
4887 | t2 = transport.get_transport(url2) |
4888 | - self.failUnless(isinstance(t, HttpTransportBase)) |
4889 | - self.failUnless(isinstance(t2, HttpTransportBase)) |
4890 | + self.assertIsInstance(t, HttpTransportBase) |
4891 | + self.assertIsInstance(t2, HttpTransportBase) |
4892 | self.assertEqual(t2.base[:-1], t.abspath('foo/bar')) |
4893 | |
4894 | def test_is_directory(self): |
4895 | @@ -664,7 +670,7 @@ |
4896 | def test_make_branch_builder(self): |
4897 | builder = self.make_branch_builder('dir') |
4898 | rev_id = builder.build_commit() |
4899 | - self.failUnlessExists('dir') |
4900 | + self.assertPathExists('dir') |
4901 | a_dir = bzrdir.BzrDir.open('dir') |
4902 | self.assertRaises(errors.NoWorkingTree, a_dir.open_workingtree) |
4903 | a_branch = a_dir.open_branch() |
4904 | @@ -686,7 +692,7 @@ |
4905 | self.assertIsInstance(result_bzrdir.transport, |
4906 | memory.MemoryTransport) |
4907 | # should not be on disk, should only be in memory |
4908 | - self.failIfExists('subdir') |
4909 | + self.assertPathDoesNotExist('subdir') |
4910 | |
4911 | |
4912 | class TestChrootedTest(tests.ChrootedTestCase): |
4913 | @@ -2366,7 +2372,7 @@ |
4914 | # stdout and stderr of the invoked run_bzr |
4915 | current_factory = bzrlib.ui.ui_factory |
4916 | self.run_bzr(['foo']) |
4917 | - self.failIf(current_factory is self.factory) |
4918 | + self.assertFalse(current_factory is self.factory) |
4919 | self.assertNotEqual(sys.stdout, self.factory.stdout) |
4920 | self.assertNotEqual(sys.stderr, self.factory.stderr) |
4921 | self.assertEqual('foo\n', self.factory.stdout.getvalue()) |
4922 | @@ -2554,7 +2560,7 @@ |
4923 | self.assertEqual([], command[2:]) |
4924 | |
4925 | def test_set_env(self): |
4926 | - self.failIf('EXISTANT_ENV_VAR' in os.environ) |
4927 | + self.assertFalse('EXISTANT_ENV_VAR' in os.environ) |
4928 | # set in the child |
4929 | def check_environment(): |
4930 | self.assertEqual('set variable', os.environ['EXISTANT_ENV_VAR']) |
4931 | @@ -2566,7 +2572,7 @@ |
4932 | |
4933 | def test_run_bzr_subprocess_env_del(self): |
4934 | """run_bzr_subprocess can remove environment variables too.""" |
4935 | - self.failIf('EXISTANT_ENV_VAR' in os.environ) |
4936 | + self.assertFalse('EXISTANT_ENV_VAR' in os.environ) |
4937 | def check_environment(): |
4938 | self.assertFalse('EXISTANT_ENV_VAR' in os.environ) |
4939 | os.environ['EXISTANT_ENV_VAR'] = 'set variable' |
4940 | @@ -2578,7 +2584,7 @@ |
4941 | del os.environ['EXISTANT_ENV_VAR'] |
4942 | |
4943 | def test_env_del_missing(self): |
4944 | - self.failIf('NON_EXISTANT_ENV_VAR' in os.environ) |
4945 | + self.assertFalse('NON_EXISTANT_ENV_VAR' in os.environ) |
4946 | def check_environment(): |
4947 | self.assertFalse('NON_EXISTANT_ENV_VAR' in os.environ) |
4948 | self.check_popen_state = check_environment |
4949 | @@ -3410,7 +3416,7 @@ |
4950 | class TestEnvironHandling(tests.TestCase): |
4951 | |
4952 | def test_overrideEnv_None_called_twice_doesnt_leak(self): |
4953 | - self.failIf('MYVAR' in os.environ) |
4954 | + self.assertFalse('MYVAR' in os.environ) |
4955 | self.overrideEnv('MYVAR', '42') |
4956 | # We use an embedded test to make sure we fix the _captureVar bug |
4957 | class Test(tests.TestCase): |
4958 | |
4959 | === modified file 'bzrlib/tests/test_sftp_transport.py' |
4960 | --- bzrlib/tests/test_sftp_transport.py 2011-01-21 22:08:19 +0000 |
4961 | +++ bzrlib/tests/test_sftp_transport.py 2011-07-14 21:01:48 +0000 |
4962 | @@ -72,14 +72,14 @@ |
4963 | t = self.get_transport() |
4964 | |
4965 | l = t.lock_write('bogus') |
4966 | - self.failUnlessExists('bogus.write-lock') |
4967 | + self.assertPathExists('bogus.write-lock') |
4968 | |
4969 | # Don't wait for the lock, locking an already locked |
4970 | # file should raise an assert |
4971 | self.assertRaises(LockError, t.lock_write, 'bogus') |
4972 | |
4973 | l.unlock() |
4974 | - self.failIf(lexists('bogus.write-lock')) |
4975 | + self.assertFalse(lexists('bogus.write-lock')) |
4976 | |
4977 | open('something.write-lock', 'wb').write('fake lock\n') |
4978 | self.assertRaises(LockError, t.lock_write, 'something') |
4979 | @@ -193,15 +193,15 @@ |
4980 | # old format branches use a special lock file on sftp. |
4981 | b = self.make_branch('', format=bzrdir.BzrDirFormat6()) |
4982 | b = bzrlib.branch.Branch.open(self.get_url()) |
4983 | - self.failUnlessExists('.bzr/') |
4984 | - self.failUnlessExists('.bzr/branch-format') |
4985 | - self.failUnlessExists('.bzr/branch-lock') |
4986 | + self.assertPathExists('.bzr/') |
4987 | + self.assertPathExists('.bzr/branch-format') |
4988 | + self.assertPathExists('.bzr/branch-lock') |
4989 | |
4990 | - self.failIf(lexists('.bzr/branch-lock.write-lock')) |
4991 | + self.assertPathDoesNotExist('.bzr/branch-lock.write-lock') |
4992 | b.lock_write() |
4993 | - self.failUnlessExists('.bzr/branch-lock.write-lock') |
4994 | + self.assertPathExists('.bzr/branch-lock.write-lock') |
4995 | b.unlock() |
4996 | - self.failIf(lexists('.bzr/branch-lock.write-lock')) |
4997 | + self.assertPathDoesNotExist('.bzr/branch-lock.write-lock') |
4998 | |
4999 | def test_push_support(self): |
5000 | self.build_tree(['a/', 'a/foo']) |
I have read the news and metadata parts of the diff, and skimmed the body of the diff. (The diff is pretty long mostly because of mechanical updates to work with Python upstream deprecations.) I think this is safe and appropriate to go into natty-proposed.