Merge lp:~gagern/bzr/setlocale into lp:~bzr/bzr/trunk-old

Proposed by Martin von Gagern
Status: Rejected
Rejected by: Robert Collins
Proposed branch: lp:~gagern/bzr/setlocale
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 1220 lines (has conflicts)
Text conflict in NEWS
Text conflict in bzrlib/log.py
Text conflict in bzrlib/osutils.py
Text conflict in bzrlib/tests/__init__.py
Text conflict in bzrlib/tests/blackbox/test_info.py
Text conflict in bzrlib/tests/test_log.py
Text conflict in bzrlib/tests/test_selftest.py
To merge this branch: bzr merge lp:~gagern/bzr/setlocale
To post a comment you must log in.
Revision history for this message
Martin von Gagern (gagern) wrote :

Digging through old list archives, it seems this branch has been mostly obsoleted by now, as a number of individual features have been spliced out and merged. I'm quoting merging bzr.dev revision numbers and mailing list subjects:

3518: setlocale mini (#128496)
3528: Remove unused call to format_date
3529: Improved UnicodeFilenameFeature
3754: local weekday support

The only remaining issue seems to be from a mailing list thread with subject "More robust handling of encoding issues in tests". I've just updated it to match current bzr.dev and pushed it to lp:~gagern/bzr/encodingSafeTests

Revision history for this message
Martin von Gagern (gagern) wrote :

Sadly there is no "Abandoned" state, and I don't feel like deleting this request just after adding a useful comment to it. Maybe if I abandon the branch?

Revision history for this message
Vincent Ladeuil (vila) wrote :

Rejected seems appropriate here.

And submit lp:~gagern/bzr/encodingSafeTests instead.

You can still reference this mp in your cover letter if you want to track it.

Revision history for this message
Robert Collins (lifeless) wrote :

Marking rejected as per Vila's comment.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-08-30 23:51:10 +0000
3+++ NEWS 2009-08-31 04:38:49 +0000
4@@ -1,5 +1,6 @@
5 ####################
6 Bazaar Release Notes
7+<<<<<<< TREE
8 ####################
9
10
11@@ -3869,6 +3870,108 @@
12 * ``RemoteToOtherFetcher`` and ``get_data_stream_for_search`` removed,
13 to support new ``VersionedFiles`` layering.
14 (Robert Collins)
15+=======
16+--------------------
17+
18+.. contents::
19+
20+
21+IN DEVELOPMENT
22+--------------
23+
24+ IMPROVEMENTS:
25+
26+ * ``bzr export --format=tgz --root=NAME -`` to export a gzipped tarball
27+ to stdout; also ``tar`` and ``tbz2``.
28+ (Martin Pool)
29+
30+ * The smart protocol now has improved support for setting branches'
31+ revision info directly. This makes operations like push
32+ faster. The new request method name is
33+ ``Branch.set_last_revision_ex``. (Andrew Bennetts)
34+
35+ BUGFIXES:
36+
37+ * Clearer message about how to set the PYTHONPATH if bzrlib can't be
38+ loaded.
39+ (Martin Pool, #205230)
40+
41+ * Errors about missing libraries are now shown without a traceback,
42+ and with a suggestion to install the library. The full traceback is
43+ still in ``.bzr.log`` and can be shown with ``-Derror``.
44+ (Martin Pool, #240161)
45+
46+ * Handle urls such as ftp://user@host.com@www.host.com where the user
47+ name contains an @.
48+ (Neil Martinsen-Burrell, #228058)
49+
50+ * ``needs_read_lock`` and ``needs_write_lock`` now suppress an error during
51+ ``unlock`` if there was an error in the original function. This helps
52+ most when there is a failure with a smart server action, since often the
53+ connection closes and we cannot unlock.
54+ (Andrew Bennetts, John Arbash Meinel, #125784)
55+
56+ * Obsolete hidden command ``bzr fetch`` removed.
57+ (Martin Pool, #172870)
58+
59+ * Raise the correct exception when doing ``-rbefore:0`` or ``-c0``.
60+ (John Arbash Meinel, #239933)
61+
62+ * You can now compare file revisions in Windows diff programs from
63+ Cygwin Bazaar.
64+ (Matt McClure, #209281)
65+
66+ * revision_history now tolerates mainline ghosts for Branch format 6.
67+ (Aaron Bentley, #235055)
68+
69+ * Set locale from environment for third party libs and day of week.
70+ (Martin von Gagern, #128496)
71+
72+ DOCUMENTATION:
73+
74+ * Updated developer documentation.
75+ (Martin Pool)
76+
77+ TESTING:
78+
79+ * ``TestCaseWithTransport.make_branch_and_tree`` tries harder to return
80+ a tree with a ``branch`` attribute of the right format. This was
81+ preventing some ``RemoteBranch`` tests from actually running with
82+ ``RemoteBranch`` instances. (Andrew Bennetts)
83+
84+ API CHANGES:
85+
86+ * Removed ``Repository.text_store``, ``control_store``, etc. Instead,
87+ there are new attributes ``texts, inventories, revisions,
88+ signatures``, each of which is a ``VersionedFiles``. See the
89+ Repository docstring for more details.
90+ (Robert Collins)
91+
92+ * ``Branch.pull`` now accepts an ``_override_hook_target`` optional
93+ parameter. If you have a subclass of ``Branch`` that overrides
94+ ``pull`` then you should add this parameter. (Andrew Bennetts)
95+
96+ * ``Tree.print_file`` and ``Repository.print_file`` are deprecated.
97+ These methods are bad APIs because they write directly to sys.stdout.
98+ bzrlib does not use them internally, and there are no direct tests
99+ for them. (Alexander Belchenko)
100+
101+ INTERNALS:
102+
103+ * ``cat`` command no longer uses ``Tree.print_file()`` internally.
104+ (Alexander Belchenko)
105+
106+ * New ``versionedfile.KeyMapper`` interface to abstract out the access to
107+ underlying .knit/.kndx etc files in repositories with partitioned
108+ storage. (Robert Collins)
109+
110+ * Obsolete developer-use command ``weave-join`` has been removed.
111+ (Robert Collins)
112+
113+ * ``RemoteToOtherFetcher`` and ``get_data_stream_for_search`` removed,
114+ to support new ``VersionedFiles`` layering.
115+ (Robert Collins)
116+>>>>>>> MERGE-SOURCE
117
118
119 bzr 1.6beta2 2008-06-10
120
121=== modified file 'bzrlib/info.py'
122--- bzrlib/info.py 2009-05-01 14:29:06 +0000
123+++ bzrlib/info.py 2009-08-31 04:38:49 +0000
124@@ -286,10 +286,10 @@
125 age = int((time.time() - timestamp) / 3600 / 24)
126 outfile.write(' %8d day%s old\n' % (age, plural(age)))
127 outfile.write(' first revision: %s\n' %
128- osutils.format_date(timestamp, timezone))
129+ osutils.format_date(timestamp, timezone, local_weekday=True))
130 timestamp, timezone = stats['latestrev']
131 outfile.write(' latest revision: %s\n' %
132- osutils.format_date(timestamp, timezone))
133+ osutils.format_date(timestamp, timezone, local_weekday=True))
134 return stats
135
136
137
138=== modified file 'bzrlib/log.py'
139--- bzrlib/log.py 2009-06-10 03:56:49 +0000
140+++ bzrlib/log.py 2009-08-31 04:38:49 +0000
141@@ -1447,7 +1447,7 @@
142
143 date_str = format_date(revision.rev.timestamp,
144 revision.rev.timezone or 0,
145- self.show_timezone)
146+ self.show_timezone, local_weekday=True)
147 to_file.write(indent + 'timestamp: %s\n' % (date_str,))
148
149 to_file.write(indent + 'message:\n')
150@@ -1505,11 +1505,19 @@
151 offset = ' ' * (revno_width + 1)
152
153 to_file = self.to_file
154+<<<<<<< TREE
155 tags = ''
156 if revision.tags:
157 tags = ' {%s}' % (', '.join(revision.tags))
158 to_file.write(indent + "%*s %s\t%s%s%s\n" % (revno_width,
159 revision.revno, self.short_author(revision.rev),
160+=======
161+ is_merge = ''
162+ if len(revision.rev.parent_ids) > 1:
163+ is_merge = ' [merge]'
164+ to_file.write("%5s %s\t%s%s\n" % (revision.revno,
165+ self.short_author(revision.rev),
166+>>>>>>> MERGE-SOURCE
167 format_date(revision.rev.timestamp,
168 revision.rev.timezone or 0,
169 self.show_timezone, date_fmt="%Y-%m-%d",
170
171=== modified file 'bzrlib/osutils.py'
172--- bzrlib/osutils.py 2009-07-23 16:01:17 +0000
173+++ bzrlib/osutils.py 2009-08-31 04:38:49 +0000
174@@ -689,7 +689,7 @@
175 weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
176
177 def format_date(t, offset=0, timezone='original', date_fmt=None,
178- show_offset=True):
179+ show_offset=True, local_weekday=False):
180 """Return a formatted date string.
181
182 :param t: Seconds since the epoch.
183@@ -744,7 +744,16 @@
184 offset_str = ' %+03d%02d' % (offset / 3600, (offset / 60) % 60)
185 else:
186 offset_str = ''
187+<<<<<<< TREE
188 return (date_fmt, tt, offset_str)
189+=======
190+ if not local_weekday:
191+ date_fmt = date_fmt.replace('%a', weekdays[tt[6]])
192+ date_str = time.strftime(date_fmt, tt)
193+ if not isinstance(date_str, unicode):
194+ date_str = date_str.decode(bzrlib.user_encoding, 'replace')
195+ return date_str + offset_str
196+>>>>>>> MERGE-SOURCE
197
198
199 def compact_date(when):
200
201=== modified file 'bzrlib/tests/__init__.py'
202--- bzrlib/tests/__init__.py 2009-08-28 21:05:31 +0000
203+++ bzrlib/tests/__init__.py 2009-08-31 04:38:49 +0000
204@@ -115,10 +115,22 @@
205
206 default_transport = LocalURLServer
207
208+<<<<<<< TREE
209 # Subunit result codes, defined here to prevent a hard dependency on subunit.
210 SUBUNIT_SEEK_SET = 0
211 SUBUNIT_SEEK_CUR = 1
212
213+=======
214+def _safe_string(string_or_unicode):
215+ if isinstance(string_or_unicode, str):
216+ return string_or_unicode.encode('string_escape').replace(r'\n', '\n')
217+ if isinstance(string_or_unicode, unicode):
218+ return string_or_unicode.encode('unicode_escape').replace(r'\n', '\n')
219+ if string_or_unicode is None:
220+ return '<None>'
221+ return str(string_or_unicode).encode('string_escape')
222+
223+>>>>>>> MERGE-SOURCE
224
225 class ExtendedTestResult(unittest._TextTestResult):
226 """Accepts, reports and accumulates the results of running tests.
227@@ -503,21 +515,37 @@
228 def _test_description(self, test):
229 return self._shortened_test_description(test)
230
231+ def _report(self, kind, test, err):
232+ descr = self._test_description(test)
233+ msg = err[1]
234+ try:
235+ self.pb.note('%s: %s\n %s\n', kind, descr, msg)
236+ except UnicodeError:
237+ self.pb.note('%s: %s\n %s\n', kind,
238+ _safe_string(descr), _safe_string(msg))
239+
240 def report_error(self, test, err):
241+<<<<<<< TREE
242 self.pb.note('ERROR: %s\n %s\n',
243 self._test_description(test),
244 err[1],
245 )
246+=======
247+ self._report('ERROR', test, err);
248+>>>>>>> MERGE-SOURCE
249
250 def report_failure(self, test, err):
251+<<<<<<< TREE
252 self.pb.note('FAIL: %s\n %s\n',
253 self._test_description(test),
254 err[1],
255 )
256+=======
257+ self._report('FAIL', test, err);
258+>>>>>>> MERGE-SOURCE
259
260 def report_known_failure(self, test, err):
261- self.pb.note('XFAIL: %s\n%s\n',
262- self._test_description(test), err[1])
263+ self._report('XFAIL', test, err);
264
265 def report_skip(self, test, reason):
266 pass
267@@ -986,9 +1014,18 @@
268 message = 'first string is missing a final newline.\n'
269 if a + '\n' == b:
270 message = 'second string is missing a final newline.\n'
271+<<<<<<< TREE
272 raise AssertionError(message +
273 self._ndiff_strings(a, b))
274
275+=======
276+ try:
277+ diff = self._ndiff_strings(a, b)
278+ except UnicodeError:
279+ diff = self._ndiff_strings(_safe_string(a), _safe_string(b))
280+ raise AssertionError(message + diff)
281+
282+>>>>>>> MERGE-SOURCE
283 def assertEqualMode(self, mode, mode_test):
284 self.assertEqual(mode, mode_test,
285 'mode mismatch %o != %o' % (mode, mode_test))
286@@ -3973,11 +4010,15 @@
287
288 def _probe(self):
289 try:
290+<<<<<<< TREE
291 # Check for character combinations unlikely to be covered by any
292 # single non-unicode encoding. We use the characters
293 # - greek small letter alpha (U+03B1) and
294 # - braille pattern dots-123456 (U+283F).
295 os.stat(u'\u03b1\u283f')
296+=======
297+ os.stat(u'\u03b1\u283f')
298+>>>>>>> MERGE-SOURCE
299 except UnicodeEncodeError:
300 return False
301 except (IOError, OSError):
302
303=== modified file 'bzrlib/tests/blackbox/test_info.py'
304--- bzrlib/tests/blackbox/test_info.py 2009-08-25 23:38:10 +0000
305+++ bzrlib/tests/blackbox/test_info.py 2009-08-31 04:38:49 +0000
306@@ -129,7 +129,7 @@
307 self.assertEqual('', err)
308 tree1.commit('commit one')
309 rev = branch1.repository.get_revision(branch1.revision_history()[0])
310- datestring_first = format_date(rev.timestamp, rev.timezone)
311+ datestring_first = format_date(rev.timestamp, rev.timezone, local_weekday=True)
312
313 # Branch standalone with push location
314 branch2 = branch1.bzrdir.sprout('branch').open_branch()
315@@ -148,7 +148,7 @@
316 self.assertEqual('', err)
317
318 out, err = self.run_bzr('info branch --verbose')
319- self.assertEqualDiff(
320+ self.assertEqualDiff((
321 """Standalone tree (format: weave)
322 Location:
323 branch root: branch
324@@ -182,7 +182,7 @@
325 Repository:
326 1 revision
327 """ % (datestring_first, datestring_first,
328- ), out)
329+ )).encode(bzrlib.user_encoding), out)
330 self.assertEqual('', err)
331
332 # Branch and bind to standalone, needs upgrade to metadir
333@@ -194,7 +194,7 @@
334 branch3.bind(branch1)
335 bound_tree = branch3.bzrdir.open_workingtree()
336 out, err = self.run_bzr('info -v bound')
337- self.assertEqualDiff(
338+ self.assertEqualDiff((
339 """Checkout (format: knit)
340 Location:
341 checkout root: bound
342@@ -231,7 +231,7 @@
343 branch3._format.get_format_description(),
344 branch3.repository._format.get_format_description(),
345 datestring_first, datestring_first,
346- ), out)
347+ )).encode(bzrlib.user_encoding), out)
348 self.assertEqual('', err)
349
350 # Checkout standalone (same as above, but does not have parent set)
351@@ -240,7 +240,7 @@
352 branch4.bind(branch1)
353 branch4.bzrdir.open_workingtree().update()
354 out, err = self.run_bzr('info checkout --verbose')
355- self.assertEqualDiff(
356+ self.assertEqualDiff((
357 """Checkout (format: knit)
358 Location:
359 checkout root: checkout
360@@ -272,15 +272,21 @@
361 1 revision
362 """ % (branch4.repository._format.get_format_description(),
363 datestring_first, datestring_first,
364- ), out)
365+ )).encode(bzrlib.user_encoding), out)
366 self.assertEqual('', err)
367
368 # Lightweight checkout (same as above, different branch and repository)
369 tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
370 branch5 = tree5.branch
371 out, err = self.run_bzr('info -v lightcheckout')
372+<<<<<<< TREE
373 self.assertEqualDiff(
374 """Lightweight checkout (format: %s)
375+=======
376+ self.assertEqualDiff((
377+"""Lightweight checkout (format: dirstate or dirstate-tags or \
378+pack-0.92 or rich-root or rich-root-pack)
379+>>>>>>> MERGE-SOURCE
380 Location:
381 light checkout root: lightcheckout
382 checkout of branch: standalone
383@@ -309,7 +315,11 @@
384
385 Repository:
386 1 revision
387+<<<<<<< TREE
388 """ % (self._repo_strings, datestring_first, datestring_first,), out)
389+=======
390+""" % (datestring_first, datestring_first,)).encode(bzrlib.user_encoding), out)
391+>>>>>>> MERGE-SOURCE
392 self.assertEqual('', err)
393
394 # Update initial standalone branch
395@@ -317,11 +327,11 @@
396 tree1.add('b')
397 tree1.commit('commit two')
398 rev = branch1.repository.get_revision(branch1.revision_history()[-1])
399- datestring_last = format_date(rev.timestamp, rev.timezone)
400+ datestring_last = format_date(rev.timestamp, rev.timezone, local_weekday=True)
401
402 # Out of date branched standalone branch will not be detected
403 out, err = self.run_bzr('info -v branch')
404- self.assertEqualDiff(
405+ self.assertEqualDiff((
406 """Standalone tree (format: weave)
407 Location:
408 branch root: branch
409@@ -355,12 +365,12 @@
410 Repository:
411 1 revision
412 """ % (datestring_first, datestring_first,
413- ), out)
414+ )).encode(bzrlib.user_encoding), out)
415 self.assertEqual('', err)
416
417 # Out of date bound branch
418 out, err = self.run_bzr('info -v bound')
419- self.assertEqualDiff(
420+ self.assertEqualDiff((
421 """Checkout (format: knit)
422 Location:
423 checkout root: bound
424@@ -397,12 +407,12 @@
425 1 revision
426 """ % (branch3.repository._format.get_format_description(),
427 datestring_first, datestring_first,
428- ), out)
429+ )).encode(bzrlib.user_encoding), out)
430 self.assertEqual('', err)
431
432 # Out of date checkout
433 out, err = self.run_bzr('info -v checkout')
434- self.assertEqualDiff(
435+ self.assertEqualDiff((
436 """Checkout (format: knit)
437 Location:
438 checkout root: checkout
439@@ -436,13 +446,19 @@
440 1 revision
441 """ % (branch4.repository._format.get_format_description(),
442 datestring_first, datestring_first,
443- ), out)
444+ )).encode(bzrlib.user_encoding), out)
445 self.assertEqual('', err)
446
447 # Out of date lightweight checkout
448 out, err = self.run_bzr('info lightcheckout --verbose')
449+<<<<<<< TREE
450 self.assertEqualDiff(
451 """Lightweight checkout (format: %s)
452+=======
453+ self.assertEqualDiff((
454+"""Lightweight checkout (format: dirstate or dirstate-tags or \
455+pack-0.92 or rich-root or rich-root-pack)
456+>>>>>>> MERGE-SOURCE
457 Location:
458 light checkout root: lightcheckout
459 checkout of branch: standalone
460@@ -473,7 +489,11 @@
461
462 Repository:
463 2 revisions
464+<<<<<<< TREE
465 """ % (self._repo_strings, datestring_first, datestring_last,), out)
466+=======
467+""" % (datestring_first, datestring_last,)).encode(bzrlib.user_encoding), out)
468+>>>>>>> MERGE-SOURCE
469 self.assertEqual('', err)
470
471 def test_info_standalone_no_tree(self):
472@@ -482,7 +502,7 @@
473 branch = self.make_branch('branch')
474 repo = branch.repository
475 out, err = self.run_bzr('info branch -v')
476- self.assertEqualDiff(
477+ self.assertEqualDiff((
478 """Standalone branch (format: %s)
479 Location:
480 branch root: branch
481@@ -500,7 +520,7 @@
482 """ % (info.describe_format(repo.bzrdir, repo, branch, None),
483 format.get_branch_format().get_format_description(),
484 format.repository_format.get_format_description(),
485- ), out)
486+ )).encode(bzrlib.user_encoding), out)
487 self.assertEqual('', err)
488
489 def test_info_shared_repository(self):
490@@ -511,7 +531,7 @@
491 repo = self.make_repository('repo', shared=True, format=format)
492 repo.set_make_working_trees(False)
493 out, err = self.run_bzr('info -v repo')
494- self.assertEqualDiff(
495+ self.assertEqualDiff((
496 """Shared repository (format: dirstate or dirstate-tags or knit)
497 Location:
498 shared repository: %s
499@@ -523,7 +543,7 @@
500 Repository:
501 0 revisions
502 """ % ('repo', format.repository_format.get_format_description(),
503- ), out)
504+ )).encode(bzrlib.user_encoding), out)
505 self.assertEqual('', err)
506
507 # Create branch inside shared repository
508@@ -531,7 +551,7 @@
509 branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
510 format=format)
511 out, err = self.run_bzr('info -v repo/branch')
512- self.assertEqualDiff(
513+ self.assertEqualDiff((
514 """Repository branch (format: dirstate or knit)
515 Location:
516 shared repository: repo
517@@ -549,7 +569,7 @@
518 0 revisions
519 """ % (format.get_branch_format().get_format_description(),
520 format.repository_format.get_format_description(),
521- ), out)
522+ )).encode(bzrlib.user_encoding), out)
523 self.assertEqual('', err)
524
525 # Create lightweight checkout
526@@ -571,10 +591,16 @@
527 tree2.add('a')
528 tree2.commit('commit one')
529 rev = repo.get_revision(branch2.revision_history()[0])
530- datestring_first = format_date(rev.timestamp, rev.timezone)
531+ datestring_first = format_date(rev.timestamp, rev.timezone, local_weekday=True)
532 out, err = self.run_bzr('info tree/lightcheckout --verbose')
533+<<<<<<< TREE
534 self.assertEqualDiff(
535 """Lightweight checkout (format: %s)
536+=======
537+ self.assertEqualDiff((
538+"""Lightweight checkout (format: dirstate or dirstate-tags or \
539+pack-0.92 or rich-root or rich-root-pack)
540+>>>>>>> MERGE-SOURCE
541 Location:
542 light checkout root: tree/lightcheckout
543 checkout of branch: repo/branch
544@@ -607,13 +633,18 @@
545 """ % (self._repo_strings, format.get_branch_format().get_format_description(),
546 format.repository_format.get_format_description(),
547 datestring_first, datestring_first,
548- ), out)
549+ )).encode(bzrlib.user_encoding), out)
550 self.assertEqual('', err)
551
552 # Out of date checkout
553 out, err = self.run_bzr('info -v tree/checkout')
554+<<<<<<< TREE
555 self.assertEqualDiff(
556 """Checkout (format: unnamed)
557+=======
558+ self.assertEqualDiff((
559+"""Checkout (format: dirstate)
560+>>>>>>> MERGE-SOURCE
561 Location:
562 checkout root: tree/checkout
563 checkout of branch: repo/branch
564@@ -643,7 +674,7 @@
565 0 revisions
566 """ % (format.get_branch_format().get_format_description(),
567 format.repository_format.get_format_description(),
568- ), out)
569+ )).encode(bzrlib.user_encoding), out)
570 self.assertEqual('', err)
571
572 # Update checkout
573@@ -651,8 +682,13 @@
574 self.build_tree(['tree/checkout/b'])
575 tree3.add('b')
576 out, err = self.run_bzr('info tree/checkout --verbose')
577+<<<<<<< TREE
578 self.assertEqualDiff(
579 """Checkout (format: unnamed)
580+=======
581+ self.assertEqualDiff((
582+"""Checkout (format: dirstate)
583+>>>>>>> MERGE-SOURCE
584 Location:
585 checkout root: tree/checkout
586 checkout of branch: repo/branch
587@@ -684,16 +720,22 @@
588 """ % (format.get_branch_format().get_format_description(),
589 format.repository_format.get_format_description(),
590 datestring_first, datestring_first,
591- ), out)
592+ )).encode(bzrlib.user_encoding), out)
593 self.assertEqual('', err)
594 tree3.commit('commit two')
595
596 # Out of date lightweight checkout
597 rev = repo.get_revision(branch1.revision_history()[-1])
598- datestring_last = format_date(rev.timestamp, rev.timezone)
599+ datestring_last = format_date(rev.timestamp, rev.timezone, local_weekday=True)
600 out, err = self.run_bzr('info tree/lightcheckout --verbose')
601+<<<<<<< TREE
602 self.assertEqualDiff(
603 """Lightweight checkout (format: %s)
604+=======
605+ self.assertEqualDiff((
606+"""Lightweight checkout (format: dirstate or dirstate-tags or \
607+pack-0.92 or rich-root or rich-root-pack)
608+>>>>>>> MERGE-SOURCE
609 Location:
610 light checkout root: tree/lightcheckout
611 checkout of branch: repo/branch
612@@ -728,12 +770,12 @@
613 """ % (self._repo_strings, format.get_branch_format().get_format_description(),
614 format.repository_format.get_format_description(),
615 datestring_first, datestring_last,
616- ), out)
617+ )).encode(bzrlib.user_encoding), out)
618 self.assertEqual('', err)
619
620 # Show info about shared branch
621 out, err = self.run_bzr('info repo/branch --verbose')
622- self.assertEqualDiff(
623+ self.assertEqualDiff((
624 """Repository branch (format: dirstate or knit)
625 Location:
626 shared repository: repo
627@@ -755,12 +797,12 @@
628 """ % (format.get_branch_format().get_format_description(),
629 format.repository_format.get_format_description(),
630 datestring_first, datestring_last,
631- ), out)
632+ )).encode(bzrlib.user_encoding), out)
633 self.assertEqual('', err)
634
635 # Show info about repository with revisions
636 out, err = self.run_bzr('info -v repo')
637- self.assertEqualDiff(
638+ self.assertEqualDiff((
639 """Shared repository (format: dirstate or dirstate-tags or knit)
640 Location:
641 shared repository: repo
642@@ -772,7 +814,7 @@
643 Repository:
644 2 revisions
645 """ % (format.repository_format.get_format_description(),
646- ), out)
647+ )).encode(bzrlib.user_encoding), out)
648 self.assertEqual('', err)
649
650 def test_info_shared_repository_with_trees(self):
651@@ -783,7 +825,7 @@
652 repo = self.make_repository('repo', shared=True, format=format)
653 repo.set_make_working_trees(True)
654 out, err = self.run_bzr('info -v repo')
655- self.assertEqualDiff(
656+ self.assertEqualDiff((
657 """Shared repository with trees (format: dirstate or dirstate-tags or knit)
658 Location:
659 shared repository: repo
660@@ -797,7 +839,7 @@
661 Repository:
662 0 revisions
663 """ % (format.repository_format.get_format_description(),
664- ), out)
665+ )).encode(bzrlib.user_encoding), out)
666 self.assertEqual('', err)
667
668 # Create two branches
669@@ -808,7 +850,7 @@
670
671 # Empty first branch
672 out, err = self.run_bzr('info repo/branch1 --verbose')
673- self.assertEqualDiff(
674+ self.assertEqualDiff((
675 """Repository tree (format: knit)
676 Location:
677 shared repository: repo
678@@ -837,7 +879,7 @@
679 0 revisions
680 """ % (format.get_branch_format().get_format_description(),
681 format.repository_format.get_format_description(),
682- ), out)
683+ )).encode(bzrlib.user_encoding), out)
684 self.assertEqual('', err)
685
686 # Update first branch
687@@ -846,9 +888,9 @@
688 tree1.add('a')
689 tree1.commit('commit one')
690 rev = repo.get_revision(branch1.revision_history()[0])
691- datestring_first = format_date(rev.timestamp, rev.timezone)
692+ datestring_first = format_date(rev.timestamp, rev.timezone, local_weekday=True)
693 out, err = self.run_bzr('info -v repo/branch1')
694- self.assertEqualDiff(
695+ self.assertEqualDiff((
696 """Repository tree (format: knit)
697 Location:
698 shared repository: repo
699@@ -881,12 +923,12 @@
700 """ % (format.get_branch_format().get_format_description(),
701 format.repository_format.get_format_description(),
702 datestring_first, datestring_first,
703- ), out)
704+ )).encode(bzrlib.user_encoding), out)
705 self.assertEqual('', err)
706
707 # Out of date second branch
708 out, err = self.run_bzr('info repo/branch2 --verbose')
709- self.assertEqualDiff(
710+ self.assertEqualDiff((
711 """Repository tree (format: knit)
712 Location:
713 shared repository: repo
714@@ -918,14 +960,14 @@
715 1 revision
716 """ % (format.get_branch_format().get_format_description(),
717 format.repository_format.get_format_description(),
718- ), out)
719+ )).encode(bzrlib.user_encoding), out)
720 self.assertEqual('', err)
721
722 # Update second branch
723 tree2 = branch2.bzrdir.open_workingtree()
724 tree2.pull(branch1)
725 out, err = self.run_bzr('info -v repo/branch2')
726- self.assertEqualDiff(
727+ self.assertEqualDiff((
728 """Repository tree (format: knit)
729 Location:
730 shared repository: repo
731@@ -961,12 +1003,12 @@
732 """ % (format.get_branch_format().get_format_description(),
733 format.repository_format.get_format_description(),
734 datestring_first, datestring_first,
735- ), out)
736+ )).encode(bzrlib.user_encoding), out)
737 self.assertEqual('', err)
738
739 # Show info about repository with revisions
740 out, err = self.run_bzr('info -v repo')
741- self.assertEqualDiff(
742+ self.assertEqualDiff((
743 """Shared repository with trees (format: dirstate or dirstate-tags or knit)
744 Location:
745 shared repository: repo
746@@ -980,7 +1022,7 @@
747 Repository:
748 1 revision
749 """ % (format.repository_format.get_format_description(),
750- ),
751+ )).encode(bzrlib.user_encoding),
752 out)
753 self.assertEqual('', err)
754
755@@ -992,7 +1034,7 @@
756 repo = self.make_repository('repo', shared=True, format=format)
757 repo.set_make_working_trees(True)
758 out, err = self.run_bzr('info -v repo')
759- self.assertEqualDiff(
760+ self.assertEqualDiff((
761 """Shared repository with trees (format: dirstate or dirstate-tags or knit)
762 Location:
763 shared repository: repo
764@@ -1006,7 +1048,7 @@
765 Repository:
766 0 revisions
767 """ % (format.repository_format.get_format_description(),
768- ), out)
769+ )).encode(bzrlib.user_encoding), out)
770 self.assertEqual('', err)
771
772 # Create branch in root of repository
773@@ -1014,7 +1056,7 @@
774 branch = control.create_branch()
775 control.create_workingtree()
776 out, err = self.run_bzr('info -v repo')
777- self.assertEqualDiff(
778+ self.assertEqualDiff((
779 """Repository tree (format: knit)
780 Location:
781 shared repository: repo
782@@ -1043,7 +1085,7 @@
783 0 revisions
784 """ % (format.get_branch_format().get_format_description(),
785 format.repository_format.get_format_description(),
786- ), out)
787+ )).encode(bzrlib.user_encoding), out)
788 self.assertEqual('', err)
789
790 def test_info_repository_hook(self):
791@@ -1175,8 +1217,13 @@
792 verbose_info = ' 0 committers\n'
793 else:
794 verbose_info = ''
795+<<<<<<< TREE
796
797 self.assertEqualDiff(
798+=======
799+
800+ self.assertEqualDiff((
801+>>>>>>> MERGE-SOURCE
802 """%s (format: %s)
803 Location:
804 %s%s
805@@ -1210,7 +1257,7 @@
806 lco_tree.branch.repository._format.get_format_description(),
807 expected_lock_output,
808 verbose_info,
809- ), out)
810+ )).encode(bzrlib.user_encoding), out)
811 self.assertEqual('', err)
812
813 def test_info_locking(self):
814@@ -1345,7 +1392,7 @@
815
816 # U U U
817 out, err = self.run_bzr('info -v branch')
818- self.assertEqualDiff(
819+ self.assertEqualDiff((
820 """Standalone tree (format: weave)
821 Location:
822 branch root: %s
823@@ -1372,12 +1419,12 @@
824 Repository:
825 0 revisions
826 """ % ('branch', tree.branch.repository._format.get_format_description(),
827- ), out)
828+ )).encode(bzrlib.user_encoding), out)
829 self.assertEqual('', err)
830 # L L L
831 tree.lock_write()
832 out, err = self.run_bzr('info -v branch')
833- self.assertEqualDiff(
834+ self.assertEqualDiff((
835 """Standalone tree (format: weave)
836 Location:
837 branch root: %s
838@@ -1404,7 +1451,7 @@
839 Repository:
840 0 revisions
841 """ % ('branch', tree.branch.repository._format.get_format_description(),
842- ), out)
843+ )).encode(bzrlib.user_encoding), out)
844 self.assertEqual('', err)
845 tree.unlock()
846
847
848=== modified file 'bzrlib/tests/blackbox/test_locale.py'
849--- bzrlib/tests/blackbox/test_locale.py 2009-08-17 22:16:49 +0000
850+++ bzrlib/tests/blackbox/test_locale.py 2009-08-31 04:38:49 +0000
851@@ -18,6 +18,7 @@
852
853 import os
854 import sys
855+import locale
856
857 from bzrlib.tests import TestCaseWithTransport, TestSkipped
858
859@@ -31,12 +32,13 @@
860 raise TestSkipped('Windows does not respond to the LANG'
861 ' env variable')
862
863+ self.comitter = u'\u062c\u0648\u062c\u0648 Meinel <juju@info.com>'
864+ self.micro = u'\xb5'
865 tree = self.make_branch_and_tree('tree')
866 self.build_tree(['tree/a'])
867 tree.add('a')
868- tree.commit(u'Unicode \xb5 commit', rev_id='r1',
869- committer=u'\u062c\u0648\u062c\u0648'
870- u' Meinel <juju@info.com>',
871+ tree.commit(u'Unicode %s commit' % self.micro, rev_id='r1',
872+ committer=self.comitter,
873 timestamp=1156451297.96, timezone=0)
874 self.tree = tree
875
876@@ -44,7 +46,8 @@
877 out, err = self.run_bzr_subprocess(
878 '--no-aliases --no-plugins log -q --log-format=long tree',
879 env_changes={'LANG':'C', 'BZR_PROGRESS_BAR':'none',
880- 'LC_ALL':None, 'LC_CTYPE':None, 'LANGUAGE':None})
881+ 'LC_ALL':None, 'LC_CTYPE':None, 'LC_TIME':None,
882+ 'LANGUAGE':None})
883 self.assertEqual('', err)
884 self.assertEqualDiff("""\
885 ------------------------------------------------------------
886@@ -56,6 +59,80 @@
887 Unicode ? commit
888 """, out)
889
890+ def _need_locale(self, test_locale, category=None):
891+ if category is None:
892+ self._need_locale(test_locale, locale.LC_COLLATE)
893+ self._need_locale(test_locale, locale.LC_CTYPE)
894+ self._need_locale(test_locale, locale.LC_MESSAGES)
895+ self._need_locale(test_locale, locale.LC_MONETARY)
896+ self._need_locale(test_locale, locale.LC_NUMERIC)
897+ self._need_locale(test_locale, locale.LC_TIME)
898+ else:
899+ try:
900+ old_locale = locale.setlocale(category, test_locale)
901+ locale.setlocale(category, old_locale)
902+ except locale.Error, e:
903+ raise TestSkipped('Locale %s not supported' % test_locale)
904+
905+ def _test_locale(self, test_locale, thursdays, encoding="utf-8"):
906+ self._need_locale(test_locale)
907+ if isinstance(thursdays, (str, unicode)):
908+ thursdays = [thursdays]
909+ out, err = self.run_bzr_subprocess(
910+ '--no-aliases --no-plugins info -q -v tree',
911+ env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
912+ self.assertEqual('', err)
913+ out, err = self.run_bzr_subprocess(
914+ '--no-aliases --no-plugins log -q --log-format=line tree',
915+ env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
916+ self.assertEqual('', err)
917+ out, err = self.run_bzr_subprocess(
918+ '--no-aliases --no-plugins log -q --log-format=short tree',
919+ env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
920+ self.assertEqual('', err)
921+ out, err = self.run_bzr_subprocess(
922+ '--no-aliases --no-plugins log -q --log-format=long tree',
923+ env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
924+ self.assertEqual('', err)
925+ template = """\
926+------------------------------------------------------------
927+revno: 1
928+committer: %s
929+branch nick: tree
930+timestamp: %s 2006-08-24 20:28:17 +0000
931+message:
932+ Unicode %s commit
933+"""
934+ comitter = self.comitter.encode(encoding, 'replace')
935+ micro = self.micro.encode(encoding, 'replace')
936+ for thursday in thursdays:
937+ thursday = thursday.encode(encoding, 'replace')
938+ if (template % (comitter, thursday, micro)) == out:
939+ return
940+ thursday = thursdays[0].encode(encoding, 'replace')
941+ self.assertEqualDiff(template % (comitter, thursday, micro), out)
942+
943+ def test_latin1_de_DE(self):
944+ self._test_locale("de_DE", "Do", "iso-8859-1")
945+
946+ def test_utf8_de_DE(self):
947+ self._test_locale("de_DE.utf8", "Do")
948+
949+ def test_utf8_fr_FR(self):
950+ self._test_locale("fr_FR.utf8", ["jeu.", "jeu"])
951+
952+ def test_utf8_es_ES(self):
953+ self._test_locale("es_ES.utf8", "jue")
954+
955+ def test_utf8_ja_JP(self):
956+ self._test_locale("ja_JP.utf8", u"\u6728")
957+
958+ def test_euc_ja_JP(self):
959+ self._test_locale("ja_JP.EUC-JP", u"\u6728", "EUC-JP")
960+
961+ def test_utf8_ru_RU(self):
962+ self._test_locale("ru_RU.utf8", u"\u0427\u0442\u0432")
963+
964 def test_log_BOGUS(self):
965 out, err = self.run_bzr_subprocess(
966 '--no-aliases --no-plugins log -q --log-format=long tree',
967
968=== modified file 'bzrlib/tests/test_log.py'
969--- bzrlib/tests/test_log.py 2009-08-19 01:44:41 +0000
970+++ bzrlib/tests/test_log.py 2009-08-31 04:38:49 +0000
971@@ -17,6 +17,7 @@
972 import os
973 from cStringIO import StringIO
974
975+<<<<<<< TREE
976 from bzrlib import (
977 errors,
978 log,
979@@ -47,6 +48,38 @@
980 To simplify testing we save logged revisions here rather than actually
981 formatting anything, so that we can precisely check the result without
982 being dependent on the formatting.
983+=======
984+from bzrlib import log
985+from bzrlib.tests import TestCase, TestCaseWithTransport
986+from bzrlib.log import (show_log,
987+ get_view_revisions,
988+ LogRevision,
989+ LogFormatter,
990+ LongLogFormatter,
991+ ShortLogFormatter,
992+ LineLogFormatter)
993+from bzrlib.branch import Branch
994+from bzrlib.errors import (
995+ BzrCommandError,
996+ InvalidRevisionNumber,
997+ )
998+from bzrlib.revision import Revision
999+from bzrlib.revisionspec import (
1000+ RevisionInfo,
1001+ RevisionSpec,
1002+ )
1003+from bzrlib.osutils import format_date
1004+
1005+
1006+class LogCatcher(LogFormatter):
1007+ """Pull log messages into list rather than displaying them.
1008+
1009+ For ease of testing we save log messages here rather than actually
1010+ formatting them, so that we can precisely check the result without
1011+ being too dependent on the exact formatting.
1012+
1013+ We should also test the LogFormatter.
1014+>>>>>>> MERGE-SOURCE
1015 """
1016
1017 supports_delta = True
1018@@ -493,24 +526,39 @@
1019 timestamp=1132711707,
1020 timezone=36000,
1021 committer='Lorem Ipsum <test@example.com>')
1022+<<<<<<< TREE
1023 logfile = file('out.tmp', 'w+')
1024 formatter = log.LongLogFormatter(to_file=logfile)
1025 log.show_log(b, formatter, verbose=True)
1026+=======
1027+ logfile = self.make_utf8_encoded_stringio()
1028+ formatter = LongLogFormatter(to_file=logfile)
1029+ show_log(b, formatter, verbose=True)
1030+>>>>>>> MERGE-SOURCE
1031 logfile.flush()
1032 logfile.seek(0)
1033 log_contents = logfile.read()
1034+<<<<<<< TREE
1035 self.assertEqualDiff('''\
1036+=======
1037+ self.assertEqualDiff(log_contents, ('''\
1038+>>>>>>> MERGE-SOURCE
1039 ------------------------------------------------------------
1040 revno: 1
1041 committer: Lorem Ipsum <test@example.com>
1042 branch nick: test_verbose_log
1043-timestamp: Wed 2005-11-23 12:08:27 +1000
1044+timestamp: %s
1045 message:
1046 add a
1047 added:
1048 a
1049+<<<<<<< TREE
1050 ''',
1051 log_contents)
1052+=======
1053+''' % (format_date(1132711707, 36000, local_weekday=True)
1054+ )).encode('utf-8'))
1055+>>>>>>> MERGE-SOURCE
1056
1057 def test_merges_are_indented_by_level(self):
1058 wt = self.make_branch_and_tree('parent')
1059@@ -628,14 +676,20 @@
1060 wt = self.make_branch_and_tree('.')
1061 b = make_commits_with_trailing_newlines(wt)
1062 sio = self.make_utf8_encoded_stringio()
1063+<<<<<<< TREE
1064 lf = log.LongLogFormatter(to_file=sio)
1065 log.show_log(b, lf)
1066 self.assertEqualDiff("""\
1067+=======
1068+ lf = LongLogFormatter(to_file=sio)
1069+ show_log(b, lf)
1070+ self.assertEqualDiff(sio.getvalue(), ("""\
1071+>>>>>>> MERGE-SOURCE
1072 ------------------------------------------------------------
1073 revno: 3
1074 committer: Joe Foo <joe@foo.com>
1075 branch nick: test
1076-timestamp: Mon 2005-11-21 09:32:56 -0600
1077+timestamp: %s
1078 message:
1079 single line with trailing newline
1080 ------------------------------------------------------------
1081@@ -643,7 +697,7 @@
1082 author: Joe Bar <joe@bar.com>
1083 committer: Joe Foo <joe@foo.com>
1084 branch nick: test
1085-timestamp: Mon 2005-11-21 09:27:22 -0600
1086+timestamp: %s
1087 message:
1088 multiline
1089 log
1090@@ -652,11 +706,18 @@
1091 revno: 1
1092 committer: Joe Foo <joe@foo.com>
1093 branch nick: test
1094-timestamp: Mon 2005-11-21 09:24:15 -0600
1095+timestamp: %s
1096 message:
1097 simple log message
1098+<<<<<<< TREE
1099 """,
1100 sio.getvalue())
1101+=======
1102+""" % (format_date(1132587176.835228920, -6*3600, local_weekday=True),
1103+ format_date(1132586842.411175966, -6*3600, local_weekday=True),
1104+ format_date(1132586655.459960938, -6*3600, local_weekday=True)
1105+ )).encode('utf-8'))
1106+>>>>>>> MERGE-SOURCE
1107
1108 def test_author_in_log(self):
1109 """Log includes the author name if it's set in
1110@@ -671,6 +732,7 @@
1111 timestamp=1132711707,
1112 timezone=36000,
1113 committer='Lorem Ipsum <test@example.com>',
1114+<<<<<<< TREE
1115 authors=['John Doe <jdoe@example.com>',
1116 'Jane Rey <jrey@example.com>'])
1117 sio = StringIO()
1118@@ -1010,6 +1072,27 @@
1119
1120
1121 class TestLineLogFormatter(tests.TestCaseWithTransport):
1122+=======
1123+ author='John Doe <jdoe@example.com>')
1124+ sio = self.make_utf8_encoded_stringio()
1125+ formatter = LongLogFormatter(to_file=sio)
1126+ show_log(b, formatter)
1127+ self.assertEqualDiff(sio.getvalue(), ('''\
1128+------------------------------------------------------------
1129+revno: 1
1130+author: John Doe <jdoe@example.com>
1131+committer: Lorem Ipsum <test@example.com>
1132+branch nick: test_author_log
1133+timestamp: %s
1134+message:
1135+ add a
1136+''' % (format_date(1132711707, 36000, local_weekday=True)
1137+ )).encode('utf-8'))
1138+
1139+
1140+
1141+class TestLineLogFormatter(TestCaseWithTransport):
1142+>>>>>>> MERGE-SOURCE
1143
1144 def test_line_log(self):
1145 """Line log should show revno
1146
1147=== modified file 'bzrlib/tests/test_selftest.py'
1148--- bzrlib/tests/test_selftest.py 2009-08-26 23:25:28 +0000
1149+++ bzrlib/tests/test_selftest.py 2009-08-31 04:38:49 +0000
1150@@ -865,6 +865,44 @@
1151 self.assertEqual(lines[1], ' foo')
1152 self.assertEqual(2, len(lines))
1153
1154+<<<<<<< TREE
1155+=======
1156+ def test_text_report_known_failure(self):
1157+ # text test output formatting
1158+ pb = MockProgress()
1159+ result = bzrlib.tests.TextTestResult(
1160+ None,
1161+ descriptions=0,
1162+ verbosity=1,
1163+ pb=pb,
1164+ )
1165+ test = self.get_passing_test()
1166+ # this seeds the state to handle reporting the test.
1167+ result.startTest(test)
1168+ # the err parameter has the shape:
1169+ # (class, exception object, traceback)
1170+ # KnownFailures dont get their tracebacks shown though, so we
1171+ # can skip that.
1172+ err = (KnownFailure, KnownFailure('foo'), None)
1173+ result.report_known_failure(test, err)
1174+ self.assertEqual(
1175+ [
1176+ ('update', '[1 in 0s] passing_test', None, None),
1177+ ('note', '%s: %s\n %s\n', ('XFAIL', 'passing_test', err[1]))
1178+ ],
1179+ pb.calls)
1180+ # known_failures should be printed in the summary, so if we run a test
1181+ # after there are some known failures, the update prefix should match
1182+ # this.
1183+ result.known_failure_count = 3
1184+ test.run(result)
1185+ self.assertEqual(
1186+ [
1187+ ('update', '[2 in 0s] passing_test', None, None),
1188+ ],
1189+ pb.calls[2:])
1190+
1191+>>>>>>> MERGE-SOURCE
1192 def get_passing_test(self):
1193 """Return a test object that can't be run usefully."""
1194 def passing_test():
1195
1196=== modified file 'bzrlib/timestamp.py'
1197--- bzrlib/timestamp.py 2009-03-23 14:59:43 +0000
1198+++ bzrlib/timestamp.py 2009-08-31 04:38:49 +0000
1199@@ -19,7 +19,6 @@
1200
1201 from bzrlib import osutils
1202
1203-
1204 def format_highres_date(t, offset=0):
1205 """Format a date, such that it includes higher precision in the
1206 seconds field.
1207@@ -35,11 +34,11 @@
1208
1209 >>> from bzrlib.osutils import format_date
1210 >>> format_date(1120153132.350850105, 0)
1211- 'Thu 2005-06-30 17:38:52 +0000'
1212+ u'Thu 2005-06-30 17:38:52 +0000'
1213 >>> format_highres_date(1120153132.350850105, 0)
1214 'Thu 2005-06-30 17:38:52.350850105 +0000'
1215 >>> format_date(1120153132.350850105, -5*3600)
1216- 'Thu 2005-06-30 12:38:52 -0500'
1217+ u'Thu 2005-06-30 12:38:52 -0500'
1218 >>> format_highres_date(1120153132.350850105, -5*3600)
1219 'Thu 2005-06-30 12:38:52.350850105 -0500'
1220 >>> format_highres_date(1120153132.350850105, 7200)