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
=== modified file 'NEWS'
--- NEWS 2009-08-30 23:51:10 +0000
+++ NEWS 2009-08-31 04:38:49 +0000
@@ -1,5 +1,6 @@
1####################1####################
2Bazaar Release Notes2Bazaar Release Notes
3<<<<<<< TREE
3####################4####################
45
56
@@ -3869,6 +3870,108 @@
3869* ``RemoteToOtherFetcher`` and ``get_data_stream_for_search`` removed,3870* ``RemoteToOtherFetcher`` and ``get_data_stream_for_search`` removed,
3870 to support new ``VersionedFiles`` layering.3871 to support new ``VersionedFiles`` layering.
3871 (Robert Collins)3872 (Robert Collins)
3873=======
3874--------------------
3875
3876.. contents::
3877
3878
3879IN DEVELOPMENT
3880--------------
3881
3882 IMPROVEMENTS:
3883
3884 * ``bzr export --format=tgz --root=NAME -`` to export a gzipped tarball
3885 to stdout; also ``tar`` and ``tbz2``.
3886 (Martin Pool)
3887
3888 * The smart protocol now has improved support for setting branches'
3889 revision info directly. This makes operations like push
3890 faster. The new request method name is
3891 ``Branch.set_last_revision_ex``. (Andrew Bennetts)
3892
3893 BUGFIXES:
3894
3895 * Clearer message about how to set the PYTHONPATH if bzrlib can't be
3896 loaded.
3897 (Martin Pool, #205230)
3898
3899 * Errors about missing libraries are now shown without a traceback,
3900 and with a suggestion to install the library. The full traceback is
3901 still in ``.bzr.log`` and can be shown with ``-Derror``.
3902 (Martin Pool, #240161)
3903
3904 * Handle urls such as ftp://user@host.com@www.host.com where the user
3905 name contains an @.
3906 (Neil Martinsen-Burrell, #228058)
3907
3908 * ``needs_read_lock`` and ``needs_write_lock`` now suppress an error during
3909 ``unlock`` if there was an error in the original function. This helps
3910 most when there is a failure with a smart server action, since often the
3911 connection closes and we cannot unlock.
3912 (Andrew Bennetts, John Arbash Meinel, #125784)
3913
3914 * Obsolete hidden command ``bzr fetch`` removed.
3915 (Martin Pool, #172870)
3916
3917 * Raise the correct exception when doing ``-rbefore:0`` or ``-c0``.
3918 (John Arbash Meinel, #239933)
3919
3920 * You can now compare file revisions in Windows diff programs from
3921 Cygwin Bazaar.
3922 (Matt McClure, #209281)
3923
3924 * revision_history now tolerates mainline ghosts for Branch format 6.
3925 (Aaron Bentley, #235055)
3926
3927 * Set locale from environment for third party libs and day of week.
3928 (Martin von Gagern, #128496)
3929
3930 DOCUMENTATION:
3931
3932 * Updated developer documentation.
3933 (Martin Pool)
3934
3935 TESTING:
3936
3937 * ``TestCaseWithTransport.make_branch_and_tree`` tries harder to return
3938 a tree with a ``branch`` attribute of the right format. This was
3939 preventing some ``RemoteBranch`` tests from actually running with
3940 ``RemoteBranch`` instances. (Andrew Bennetts)
3941
3942 API CHANGES:
3943
3944 * Removed ``Repository.text_store``, ``control_store``, etc. Instead,
3945 there are new attributes ``texts, inventories, revisions,
3946 signatures``, each of which is a ``VersionedFiles``. See the
3947 Repository docstring for more details.
3948 (Robert Collins)
3949
3950 * ``Branch.pull`` now accepts an ``_override_hook_target`` optional
3951 parameter. If you have a subclass of ``Branch`` that overrides
3952 ``pull`` then you should add this parameter. (Andrew Bennetts)
3953
3954 * ``Tree.print_file`` and ``Repository.print_file`` are deprecated.
3955 These methods are bad APIs because they write directly to sys.stdout.
3956 bzrlib does not use them internally, and there are no direct tests
3957 for them. (Alexander Belchenko)
3958
3959 INTERNALS:
3960
3961 * ``cat`` command no longer uses ``Tree.print_file()`` internally.
3962 (Alexander Belchenko)
3963
3964 * New ``versionedfile.KeyMapper`` interface to abstract out the access to
3965 underlying .knit/.kndx etc files in repositories with partitioned
3966 storage. (Robert Collins)
3967
3968 * Obsolete developer-use command ``weave-join`` has been removed.
3969 (Robert Collins)
3970
3971 * ``RemoteToOtherFetcher`` and ``get_data_stream_for_search`` removed,
3972 to support new ``VersionedFiles`` layering.
3973 (Robert Collins)
3974>>>>>>> MERGE-SOURCE
38723975
38733976
3874bzr 1.6beta2 2008-06-103977bzr 1.6beta2 2008-06-10
38753978
=== modified file 'bzrlib/info.py'
--- bzrlib/info.py 2009-05-01 14:29:06 +0000
+++ bzrlib/info.py 2009-08-31 04:38:49 +0000
@@ -286,10 +286,10 @@
286 age = int((time.time() - timestamp) / 3600 / 24)286 age = int((time.time() - timestamp) / 3600 / 24)
287 outfile.write(' %8d day%s old\n' % (age, plural(age)))287 outfile.write(' %8d day%s old\n' % (age, plural(age)))
288 outfile.write(' first revision: %s\n' %288 outfile.write(' first revision: %s\n' %
289 osutils.format_date(timestamp, timezone))289 osutils.format_date(timestamp, timezone, local_weekday=True))
290 timestamp, timezone = stats['latestrev']290 timestamp, timezone = stats['latestrev']
291 outfile.write(' latest revision: %s\n' %291 outfile.write(' latest revision: %s\n' %
292 osutils.format_date(timestamp, timezone))292 osutils.format_date(timestamp, timezone, local_weekday=True))
293 return stats293 return stats
294294
295295
296296
=== modified file 'bzrlib/log.py'
--- bzrlib/log.py 2009-06-10 03:56:49 +0000
+++ bzrlib/log.py 2009-08-31 04:38:49 +0000
@@ -1447,7 +1447,7 @@
14471447
1448 date_str = format_date(revision.rev.timestamp,1448 date_str = format_date(revision.rev.timestamp,
1449 revision.rev.timezone or 0,1449 revision.rev.timezone or 0,
1450 self.show_timezone)1450 self.show_timezone, local_weekday=True)
1451 to_file.write(indent + 'timestamp: %s\n' % (date_str,))1451 to_file.write(indent + 'timestamp: %s\n' % (date_str,))
14521452
1453 to_file.write(indent + 'message:\n')1453 to_file.write(indent + 'message:\n')
@@ -1505,11 +1505,19 @@
1505 offset = ' ' * (revno_width + 1)1505 offset = ' ' * (revno_width + 1)
15061506
1507 to_file = self.to_file1507 to_file = self.to_file
1508<<<<<<< TREE
1508 tags = ''1509 tags = ''
1509 if revision.tags:1510 if revision.tags:
1510 tags = ' {%s}' % (', '.join(revision.tags))1511 tags = ' {%s}' % (', '.join(revision.tags))
1511 to_file.write(indent + "%*s %s\t%s%s%s\n" % (revno_width,1512 to_file.write(indent + "%*s %s\t%s%s%s\n" % (revno_width,
1512 revision.revno, self.short_author(revision.rev),1513 revision.revno, self.short_author(revision.rev),
1514=======
1515 is_merge = ''
1516 if len(revision.rev.parent_ids) > 1:
1517 is_merge = ' [merge]'
1518 to_file.write("%5s %s\t%s%s\n" % (revision.revno,
1519 self.short_author(revision.rev),
1520>>>>>>> MERGE-SOURCE
1513 format_date(revision.rev.timestamp,1521 format_date(revision.rev.timestamp,
1514 revision.rev.timezone or 0,1522 revision.rev.timezone or 0,
1515 self.show_timezone, date_fmt="%Y-%m-%d",1523 self.show_timezone, date_fmt="%Y-%m-%d",
15161524
=== modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py 2009-07-23 16:01:17 +0000
+++ bzrlib/osutils.py 2009-08-31 04:38:49 +0000
@@ -689,7 +689,7 @@
689weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']689weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
690690
691def format_date(t, offset=0, timezone='original', date_fmt=None,691def format_date(t, offset=0, timezone='original', date_fmt=None,
692 show_offset=True):692 show_offset=True, local_weekday=False):
693 """Return a formatted date string.693 """Return a formatted date string.
694694
695 :param t: Seconds since the epoch.695 :param t: Seconds since the epoch.
@@ -744,7 +744,16 @@
744 offset_str = ' %+03d%02d' % (offset / 3600, (offset / 60) % 60)744 offset_str = ' %+03d%02d' % (offset / 3600, (offset / 60) % 60)
745 else:745 else:
746 offset_str = ''746 offset_str = ''
747<<<<<<< TREE
747 return (date_fmt, tt, offset_str)748 return (date_fmt, tt, offset_str)
749=======
750 if not local_weekday:
751 date_fmt = date_fmt.replace('%a', weekdays[tt[6]])
752 date_str = time.strftime(date_fmt, tt)
753 if not isinstance(date_str, unicode):
754 date_str = date_str.decode(bzrlib.user_encoding, 'replace')
755 return date_str + offset_str
756>>>>>>> MERGE-SOURCE
748757
749758
750def compact_date(when):759def compact_date(when):
751760
=== modified file 'bzrlib/tests/__init__.py'
--- bzrlib/tests/__init__.py 2009-08-28 21:05:31 +0000
+++ bzrlib/tests/__init__.py 2009-08-31 04:38:49 +0000
@@ -115,10 +115,22 @@
115115
116default_transport = LocalURLServer116default_transport = LocalURLServer
117117
118<<<<<<< TREE
118# Subunit result codes, defined here to prevent a hard dependency on subunit.119# Subunit result codes, defined here to prevent a hard dependency on subunit.
119SUBUNIT_SEEK_SET = 0120SUBUNIT_SEEK_SET = 0
120SUBUNIT_SEEK_CUR = 1121SUBUNIT_SEEK_CUR = 1
121122
123=======
124def _safe_string(string_or_unicode):
125 if isinstance(string_or_unicode, str):
126 return string_or_unicode.encode('string_escape').replace(r'\n', '\n')
127 if isinstance(string_or_unicode, unicode):
128 return string_or_unicode.encode('unicode_escape').replace(r'\n', '\n')
129 if string_or_unicode is None:
130 return '<None>'
131 return str(string_or_unicode).encode('string_escape')
132
133>>>>>>> MERGE-SOURCE
122134
123class ExtendedTestResult(unittest._TextTestResult):135class ExtendedTestResult(unittest._TextTestResult):
124 """Accepts, reports and accumulates the results of running tests.136 """Accepts, reports and accumulates the results of running tests.
@@ -503,21 +515,37 @@
503 def _test_description(self, test):515 def _test_description(self, test):
504 return self._shortened_test_description(test)516 return self._shortened_test_description(test)
505517
518 def _report(self, kind, test, err):
519 descr = self._test_description(test)
520 msg = err[1]
521 try:
522 self.pb.note('%s: %s\n %s\n', kind, descr, msg)
523 except UnicodeError:
524 self.pb.note('%s: %s\n %s\n', kind,
525 _safe_string(descr), _safe_string(msg))
526
506 def report_error(self, test, err):527 def report_error(self, test, err):
528<<<<<<< TREE
507 self.pb.note('ERROR: %s\n %s\n',529 self.pb.note('ERROR: %s\n %s\n',
508 self._test_description(test),530 self._test_description(test),
509 err[1],531 err[1],
510 )532 )
533=======
534 self._report('ERROR', test, err);
535>>>>>>> MERGE-SOURCE
511536
512 def report_failure(self, test, err):537 def report_failure(self, test, err):
538<<<<<<< TREE
513 self.pb.note('FAIL: %s\n %s\n',539 self.pb.note('FAIL: %s\n %s\n',
514 self._test_description(test),540 self._test_description(test),
515 err[1],541 err[1],
516 )542 )
543=======
544 self._report('FAIL', test, err);
545>>>>>>> MERGE-SOURCE
517546
518 def report_known_failure(self, test, err):547 def report_known_failure(self, test, err):
519 self.pb.note('XFAIL: %s\n%s\n',548 self._report('XFAIL', test, err);
520 self._test_description(test), err[1])
521549
522 def report_skip(self, test, reason):550 def report_skip(self, test, reason):
523 pass551 pass
@@ -986,9 +1014,18 @@
986 message = 'first string is missing a final newline.\n'1014 message = 'first string is missing a final newline.\n'
987 if a + '\n' == b:1015 if a + '\n' == b:
988 message = 'second string is missing a final newline.\n'1016 message = 'second string is missing a final newline.\n'
1017<<<<<<< TREE
989 raise AssertionError(message +1018 raise AssertionError(message +
990 self._ndiff_strings(a, b))1019 self._ndiff_strings(a, b))
9911020
1021=======
1022 try:
1023 diff = self._ndiff_strings(a, b)
1024 except UnicodeError:
1025 diff = self._ndiff_strings(_safe_string(a), _safe_string(b))
1026 raise AssertionError(message + diff)
1027
1028>>>>>>> MERGE-SOURCE
992 def assertEqualMode(self, mode, mode_test):1029 def assertEqualMode(self, mode, mode_test):
993 self.assertEqual(mode, mode_test,1030 self.assertEqual(mode, mode_test,
994 'mode mismatch %o != %o' % (mode, mode_test))1031 'mode mismatch %o != %o' % (mode, mode_test))
@@ -3973,11 +4010,15 @@
39734010
3974 def _probe(self):4011 def _probe(self):
3975 try:4012 try:
4013<<<<<<< TREE
3976 # Check for character combinations unlikely to be covered by any4014 # Check for character combinations unlikely to be covered by any
3977 # single non-unicode encoding. We use the characters4015 # single non-unicode encoding. We use the characters
3978 # - greek small letter alpha (U+03B1) and4016 # - greek small letter alpha (U+03B1) and
3979 # - braille pattern dots-123456 (U+283F).4017 # - braille pattern dots-123456 (U+283F).
3980 os.stat(u'\u03b1\u283f')4018 os.stat(u'\u03b1\u283f')
4019=======
4020 os.stat(u'\u03b1\u283f')
4021>>>>>>> MERGE-SOURCE
3981 except UnicodeEncodeError:4022 except UnicodeEncodeError:
3982 return False4023 return False
3983 except (IOError, OSError):4024 except (IOError, OSError):
39844025
=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- bzrlib/tests/blackbox/test_info.py 2009-08-25 23:38:10 +0000
+++ bzrlib/tests/blackbox/test_info.py 2009-08-31 04:38:49 +0000
@@ -129,7 +129,7 @@
129 self.assertEqual('', err)129 self.assertEqual('', err)
130 tree1.commit('commit one')130 tree1.commit('commit one')
131 rev = branch1.repository.get_revision(branch1.revision_history()[0])131 rev = branch1.repository.get_revision(branch1.revision_history()[0])
132 datestring_first = format_date(rev.timestamp, rev.timezone)132 datestring_first = format_date(rev.timestamp, rev.timezone, local_weekday=True)
133133
134 # Branch standalone with push location134 # Branch standalone with push location
135 branch2 = branch1.bzrdir.sprout('branch').open_branch()135 branch2 = branch1.bzrdir.sprout('branch').open_branch()
@@ -148,7 +148,7 @@
148 self.assertEqual('', err)148 self.assertEqual('', err)
149149
150 out, err = self.run_bzr('info branch --verbose')150 out, err = self.run_bzr('info branch --verbose')
151 self.assertEqualDiff(151 self.assertEqualDiff((
152"""Standalone tree (format: weave)152"""Standalone tree (format: weave)
153Location:153Location:
154 branch root: branch154 branch root: branch
@@ -182,7 +182,7 @@
182Repository:182Repository:
183 1 revision183 1 revision
184""" % (datestring_first, datestring_first,184""" % (datestring_first, datestring_first,
185 ), out)185 )).encode(bzrlib.user_encoding), out)
186 self.assertEqual('', err)186 self.assertEqual('', err)
187187
188 # Branch and bind to standalone, needs upgrade to metadir188 # Branch and bind to standalone, needs upgrade to metadir
@@ -194,7 +194,7 @@
194 branch3.bind(branch1)194 branch3.bind(branch1)
195 bound_tree = branch3.bzrdir.open_workingtree()195 bound_tree = branch3.bzrdir.open_workingtree()
196 out, err = self.run_bzr('info -v bound')196 out, err = self.run_bzr('info -v bound')
197 self.assertEqualDiff(197 self.assertEqualDiff((
198"""Checkout (format: knit)198"""Checkout (format: knit)
199Location:199Location:
200 checkout root: bound200 checkout root: bound
@@ -231,7 +231,7 @@
231 branch3._format.get_format_description(),231 branch3._format.get_format_description(),
232 branch3.repository._format.get_format_description(),232 branch3.repository._format.get_format_description(),
233 datestring_first, datestring_first,233 datestring_first, datestring_first,
234 ), out)234 )).encode(bzrlib.user_encoding), out)
235 self.assertEqual('', err)235 self.assertEqual('', err)
236236
237 # Checkout standalone (same as above, but does not have parent set)237 # Checkout standalone (same as above, but does not have parent set)
@@ -240,7 +240,7 @@
240 branch4.bind(branch1)240 branch4.bind(branch1)
241 branch4.bzrdir.open_workingtree().update()241 branch4.bzrdir.open_workingtree().update()
242 out, err = self.run_bzr('info checkout --verbose')242 out, err = self.run_bzr('info checkout --verbose')
243 self.assertEqualDiff(243 self.assertEqualDiff((
244"""Checkout (format: knit)244"""Checkout (format: knit)
245Location:245Location:
246 checkout root: checkout246 checkout root: checkout
@@ -272,15 +272,21 @@
272 1 revision272 1 revision
273""" % (branch4.repository._format.get_format_description(),273""" % (branch4.repository._format.get_format_description(),
274 datestring_first, datestring_first,274 datestring_first, datestring_first,
275 ), out)275 )).encode(bzrlib.user_encoding), out)
276 self.assertEqual('', err)276 self.assertEqual('', err)
277277
278 # Lightweight checkout (same as above, different branch and repository)278 # Lightweight checkout (same as above, different branch and repository)
279 tree5 = branch1.create_checkout('lightcheckout', lightweight=True)279 tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
280 branch5 = tree5.branch280 branch5 = tree5.branch
281 out, err = self.run_bzr('info -v lightcheckout')281 out, err = self.run_bzr('info -v lightcheckout')
282<<<<<<< TREE
282 self.assertEqualDiff(283 self.assertEqualDiff(
283"""Lightweight checkout (format: %s)284"""Lightweight checkout (format: %s)
285=======
286 self.assertEqualDiff((
287"""Lightweight checkout (format: dirstate or dirstate-tags or \
288pack-0.92 or rich-root or rich-root-pack)
289>>>>>>> MERGE-SOURCE
284Location:290Location:
285 light checkout root: lightcheckout291 light checkout root: lightcheckout
286 checkout of branch: standalone292 checkout of branch: standalone
@@ -309,7 +315,11 @@
309315
310Repository:316Repository:
311 1 revision317 1 revision
318<<<<<<< TREE
312""" % (self._repo_strings, datestring_first, datestring_first,), out)319""" % (self._repo_strings, datestring_first, datestring_first,), out)
320=======
321""" % (datestring_first, datestring_first,)).encode(bzrlib.user_encoding), out)
322>>>>>>> MERGE-SOURCE
313 self.assertEqual('', err)323 self.assertEqual('', err)
314324
315 # Update initial standalone branch325 # Update initial standalone branch
@@ -317,11 +327,11 @@
317 tree1.add('b')327 tree1.add('b')
318 tree1.commit('commit two')328 tree1.commit('commit two')
319 rev = branch1.repository.get_revision(branch1.revision_history()[-1])329 rev = branch1.repository.get_revision(branch1.revision_history()[-1])
320 datestring_last = format_date(rev.timestamp, rev.timezone)330 datestring_last = format_date(rev.timestamp, rev.timezone, local_weekday=True)
321331
322 # Out of date branched standalone branch will not be detected332 # Out of date branched standalone branch will not be detected
323 out, err = self.run_bzr('info -v branch')333 out, err = self.run_bzr('info -v branch')
324 self.assertEqualDiff(334 self.assertEqualDiff((
325"""Standalone tree (format: weave)335"""Standalone tree (format: weave)
326Location:336Location:
327 branch root: branch337 branch root: branch
@@ -355,12 +365,12 @@
355Repository:365Repository:
356 1 revision366 1 revision
357""" % (datestring_first, datestring_first,367""" % (datestring_first, datestring_first,
358 ), out)368 )).encode(bzrlib.user_encoding), out)
359 self.assertEqual('', err)369 self.assertEqual('', err)
360370
361 # Out of date bound branch371 # Out of date bound branch
362 out, err = self.run_bzr('info -v bound')372 out, err = self.run_bzr('info -v bound')
363 self.assertEqualDiff(373 self.assertEqualDiff((
364"""Checkout (format: knit)374"""Checkout (format: knit)
365Location:375Location:
366 checkout root: bound376 checkout root: bound
@@ -397,12 +407,12 @@
397 1 revision407 1 revision
398""" % (branch3.repository._format.get_format_description(),408""" % (branch3.repository._format.get_format_description(),
399 datestring_first, datestring_first,409 datestring_first, datestring_first,
400 ), out)410 )).encode(bzrlib.user_encoding), out)
401 self.assertEqual('', err)411 self.assertEqual('', err)
402412
403 # Out of date checkout413 # Out of date checkout
404 out, err = self.run_bzr('info -v checkout')414 out, err = self.run_bzr('info -v checkout')
405 self.assertEqualDiff(415 self.assertEqualDiff((
406"""Checkout (format: knit)416"""Checkout (format: knit)
407Location:417Location:
408 checkout root: checkout418 checkout root: checkout
@@ -436,13 +446,19 @@
436 1 revision446 1 revision
437""" % (branch4.repository._format.get_format_description(),447""" % (branch4.repository._format.get_format_description(),
438 datestring_first, datestring_first,448 datestring_first, datestring_first,
439 ), out)449 )).encode(bzrlib.user_encoding), out)
440 self.assertEqual('', err)450 self.assertEqual('', err)
441451
442 # Out of date lightweight checkout452 # Out of date lightweight checkout
443 out, err = self.run_bzr('info lightcheckout --verbose')453 out, err = self.run_bzr('info lightcheckout --verbose')
454<<<<<<< TREE
444 self.assertEqualDiff(455 self.assertEqualDiff(
445"""Lightweight checkout (format: %s)456"""Lightweight checkout (format: %s)
457=======
458 self.assertEqualDiff((
459"""Lightweight checkout (format: dirstate or dirstate-tags or \
460pack-0.92 or rich-root or rich-root-pack)
461>>>>>>> MERGE-SOURCE
446Location:462Location:
447 light checkout root: lightcheckout463 light checkout root: lightcheckout
448 checkout of branch: standalone464 checkout of branch: standalone
@@ -473,7 +489,11 @@
473489
474Repository:490Repository:
475 2 revisions491 2 revisions
492<<<<<<< TREE
476""" % (self._repo_strings, datestring_first, datestring_last,), out)493""" % (self._repo_strings, datestring_first, datestring_last,), out)
494=======
495""" % (datestring_first, datestring_last,)).encode(bzrlib.user_encoding), out)
496>>>>>>> MERGE-SOURCE
477 self.assertEqual('', err)497 self.assertEqual('', err)
478498
479 def test_info_standalone_no_tree(self):499 def test_info_standalone_no_tree(self):
@@ -482,7 +502,7 @@
482 branch = self.make_branch('branch')502 branch = self.make_branch('branch')
483 repo = branch.repository503 repo = branch.repository
484 out, err = self.run_bzr('info branch -v')504 out, err = self.run_bzr('info branch -v')
485 self.assertEqualDiff(505 self.assertEqualDiff((
486"""Standalone branch (format: %s)506"""Standalone branch (format: %s)
487Location:507Location:
488 branch root: branch508 branch root: branch
@@ -500,7 +520,7 @@
500""" % (info.describe_format(repo.bzrdir, repo, branch, None),520""" % (info.describe_format(repo.bzrdir, repo, branch, None),
501 format.get_branch_format().get_format_description(),521 format.get_branch_format().get_format_description(),
502 format.repository_format.get_format_description(),522 format.repository_format.get_format_description(),
503 ), out)523 )).encode(bzrlib.user_encoding), out)
504 self.assertEqual('', err)524 self.assertEqual('', err)
505525
506 def test_info_shared_repository(self):526 def test_info_shared_repository(self):
@@ -511,7 +531,7 @@
511 repo = self.make_repository('repo', shared=True, format=format)531 repo = self.make_repository('repo', shared=True, format=format)
512 repo.set_make_working_trees(False)532 repo.set_make_working_trees(False)
513 out, err = self.run_bzr('info -v repo')533 out, err = self.run_bzr('info -v repo')
514 self.assertEqualDiff(534 self.assertEqualDiff((
515"""Shared repository (format: dirstate or dirstate-tags or knit)535"""Shared repository (format: dirstate or dirstate-tags or knit)
516Location:536Location:
517 shared repository: %s537 shared repository: %s
@@ -523,7 +543,7 @@
523Repository:543Repository:
524 0 revisions544 0 revisions
525""" % ('repo', format.repository_format.get_format_description(),545""" % ('repo', format.repository_format.get_format_description(),
526 ), out)546 )).encode(bzrlib.user_encoding), out)
527 self.assertEqual('', err)547 self.assertEqual('', err)
528548
529 # Create branch inside shared repository549 # Create branch inside shared repository
@@ -531,7 +551,7 @@
531 branch1 = repo.bzrdir.create_branch_convenience('repo/branch',551 branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
532 format=format)552 format=format)
533 out, err = self.run_bzr('info -v repo/branch')553 out, err = self.run_bzr('info -v repo/branch')
534 self.assertEqualDiff(554 self.assertEqualDiff((
535"""Repository branch (format: dirstate or knit)555"""Repository branch (format: dirstate or knit)
536Location:556Location:
537 shared repository: repo557 shared repository: repo
@@ -549,7 +569,7 @@
549 0 revisions569 0 revisions
550""" % (format.get_branch_format().get_format_description(),570""" % (format.get_branch_format().get_format_description(),
551 format.repository_format.get_format_description(),571 format.repository_format.get_format_description(),
552 ), out)572 )).encode(bzrlib.user_encoding), out)
553 self.assertEqual('', err)573 self.assertEqual('', err)
554574
555 # Create lightweight checkout575 # Create lightweight checkout
@@ -571,10 +591,16 @@
571 tree2.add('a')591 tree2.add('a')
572 tree2.commit('commit one')592 tree2.commit('commit one')
573 rev = repo.get_revision(branch2.revision_history()[0])593 rev = repo.get_revision(branch2.revision_history()[0])
574 datestring_first = format_date(rev.timestamp, rev.timezone)594 datestring_first = format_date(rev.timestamp, rev.timezone, local_weekday=True)
575 out, err = self.run_bzr('info tree/lightcheckout --verbose')595 out, err = self.run_bzr('info tree/lightcheckout --verbose')
596<<<<<<< TREE
576 self.assertEqualDiff(597 self.assertEqualDiff(
577"""Lightweight checkout (format: %s)598"""Lightweight checkout (format: %s)
599=======
600 self.assertEqualDiff((
601"""Lightweight checkout (format: dirstate or dirstate-tags or \
602pack-0.92 or rich-root or rich-root-pack)
603>>>>>>> MERGE-SOURCE
578Location:604Location:
579 light checkout root: tree/lightcheckout605 light checkout root: tree/lightcheckout
580 checkout of branch: repo/branch606 checkout of branch: repo/branch
@@ -607,13 +633,18 @@
607""" % (self._repo_strings, format.get_branch_format().get_format_description(),633""" % (self._repo_strings, format.get_branch_format().get_format_description(),
608 format.repository_format.get_format_description(),634 format.repository_format.get_format_description(),
609 datestring_first, datestring_first,635 datestring_first, datestring_first,
610 ), out)636 )).encode(bzrlib.user_encoding), out)
611 self.assertEqual('', err)637 self.assertEqual('', err)
612638
613 # Out of date checkout639 # Out of date checkout
614 out, err = self.run_bzr('info -v tree/checkout')640 out, err = self.run_bzr('info -v tree/checkout')
641<<<<<<< TREE
615 self.assertEqualDiff(642 self.assertEqualDiff(
616"""Checkout (format: unnamed)643"""Checkout (format: unnamed)
644=======
645 self.assertEqualDiff((
646"""Checkout (format: dirstate)
647>>>>>>> MERGE-SOURCE
617Location:648Location:
618 checkout root: tree/checkout649 checkout root: tree/checkout
619 checkout of branch: repo/branch650 checkout of branch: repo/branch
@@ -643,7 +674,7 @@
643 0 revisions674 0 revisions
644""" % (format.get_branch_format().get_format_description(),675""" % (format.get_branch_format().get_format_description(),
645 format.repository_format.get_format_description(),676 format.repository_format.get_format_description(),
646 ), out)677 )).encode(bzrlib.user_encoding), out)
647 self.assertEqual('', err)678 self.assertEqual('', err)
648679
649 # Update checkout680 # Update checkout
@@ -651,8 +682,13 @@
651 self.build_tree(['tree/checkout/b'])682 self.build_tree(['tree/checkout/b'])
652 tree3.add('b')683 tree3.add('b')
653 out, err = self.run_bzr('info tree/checkout --verbose')684 out, err = self.run_bzr('info tree/checkout --verbose')
685<<<<<<< TREE
654 self.assertEqualDiff(686 self.assertEqualDiff(
655"""Checkout (format: unnamed)687"""Checkout (format: unnamed)
688=======
689 self.assertEqualDiff((
690"""Checkout (format: dirstate)
691>>>>>>> MERGE-SOURCE
656Location:692Location:
657 checkout root: tree/checkout693 checkout root: tree/checkout
658 checkout of branch: repo/branch694 checkout of branch: repo/branch
@@ -684,16 +720,22 @@
684""" % (format.get_branch_format().get_format_description(),720""" % (format.get_branch_format().get_format_description(),
685 format.repository_format.get_format_description(),721 format.repository_format.get_format_description(),
686 datestring_first, datestring_first,722 datestring_first, datestring_first,
687 ), out)723 )).encode(bzrlib.user_encoding), out)
688 self.assertEqual('', err)724 self.assertEqual('', err)
689 tree3.commit('commit two')725 tree3.commit('commit two')
690726
691 # Out of date lightweight checkout727 # Out of date lightweight checkout
692 rev = repo.get_revision(branch1.revision_history()[-1])728 rev = repo.get_revision(branch1.revision_history()[-1])
693 datestring_last = format_date(rev.timestamp, rev.timezone)729 datestring_last = format_date(rev.timestamp, rev.timezone, local_weekday=True)
694 out, err = self.run_bzr('info tree/lightcheckout --verbose')730 out, err = self.run_bzr('info tree/lightcheckout --verbose')
731<<<<<<< TREE
695 self.assertEqualDiff(732 self.assertEqualDiff(
696"""Lightweight checkout (format: %s)733"""Lightweight checkout (format: %s)
734=======
735 self.assertEqualDiff((
736"""Lightweight checkout (format: dirstate or dirstate-tags or \
737pack-0.92 or rich-root or rich-root-pack)
738>>>>>>> MERGE-SOURCE
697Location:739Location:
698 light checkout root: tree/lightcheckout740 light checkout root: tree/lightcheckout
699 checkout of branch: repo/branch741 checkout of branch: repo/branch
@@ -728,12 +770,12 @@
728""" % (self._repo_strings, format.get_branch_format().get_format_description(),770""" % (self._repo_strings, format.get_branch_format().get_format_description(),
729 format.repository_format.get_format_description(),771 format.repository_format.get_format_description(),
730 datestring_first, datestring_last,772 datestring_first, datestring_last,
731 ), out)773 )).encode(bzrlib.user_encoding), out)
732 self.assertEqual('', err)774 self.assertEqual('', err)
733775
734 # Show info about shared branch776 # Show info about shared branch
735 out, err = self.run_bzr('info repo/branch --verbose')777 out, err = self.run_bzr('info repo/branch --verbose')
736 self.assertEqualDiff(778 self.assertEqualDiff((
737"""Repository branch (format: dirstate or knit)779"""Repository branch (format: dirstate or knit)
738Location:780Location:
739 shared repository: repo781 shared repository: repo
@@ -755,12 +797,12 @@
755""" % (format.get_branch_format().get_format_description(),797""" % (format.get_branch_format().get_format_description(),
756 format.repository_format.get_format_description(),798 format.repository_format.get_format_description(),
757 datestring_first, datestring_last,799 datestring_first, datestring_last,
758 ), out)800 )).encode(bzrlib.user_encoding), out)
759 self.assertEqual('', err)801 self.assertEqual('', err)
760802
761 # Show info about repository with revisions803 # Show info about repository with revisions
762 out, err = self.run_bzr('info -v repo')804 out, err = self.run_bzr('info -v repo')
763 self.assertEqualDiff(805 self.assertEqualDiff((
764"""Shared repository (format: dirstate or dirstate-tags or knit)806"""Shared repository (format: dirstate or dirstate-tags or knit)
765Location:807Location:
766 shared repository: repo808 shared repository: repo
@@ -772,7 +814,7 @@
772Repository:814Repository:
773 2 revisions815 2 revisions
774""" % (format.repository_format.get_format_description(),816""" % (format.repository_format.get_format_description(),
775 ), out)817 )).encode(bzrlib.user_encoding), out)
776 self.assertEqual('', err)818 self.assertEqual('', err)
777819
778 def test_info_shared_repository_with_trees(self):820 def test_info_shared_repository_with_trees(self):
@@ -783,7 +825,7 @@
783 repo = self.make_repository('repo', shared=True, format=format)825 repo = self.make_repository('repo', shared=True, format=format)
784 repo.set_make_working_trees(True)826 repo.set_make_working_trees(True)
785 out, err = self.run_bzr('info -v repo')827 out, err = self.run_bzr('info -v repo')
786 self.assertEqualDiff(828 self.assertEqualDiff((
787"""Shared repository with trees (format: dirstate or dirstate-tags or knit)829"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
788Location:830Location:
789 shared repository: repo831 shared repository: repo
@@ -797,7 +839,7 @@
797Repository:839Repository:
798 0 revisions840 0 revisions
799""" % (format.repository_format.get_format_description(),841""" % (format.repository_format.get_format_description(),
800 ), out)842 )).encode(bzrlib.user_encoding), out)
801 self.assertEqual('', err)843 self.assertEqual('', err)
802844
803 # Create two branches845 # Create two branches
@@ -808,7 +850,7 @@
808850
809 # Empty first branch851 # Empty first branch
810 out, err = self.run_bzr('info repo/branch1 --verbose')852 out, err = self.run_bzr('info repo/branch1 --verbose')
811 self.assertEqualDiff(853 self.assertEqualDiff((
812"""Repository tree (format: knit)854"""Repository tree (format: knit)
813Location:855Location:
814 shared repository: repo856 shared repository: repo
@@ -837,7 +879,7 @@
837 0 revisions879 0 revisions
838""" % (format.get_branch_format().get_format_description(),880""" % (format.get_branch_format().get_format_description(),
839 format.repository_format.get_format_description(),881 format.repository_format.get_format_description(),
840 ), out)882 )).encode(bzrlib.user_encoding), out)
841 self.assertEqual('', err)883 self.assertEqual('', err)
842884
843 # Update first branch885 # Update first branch
@@ -846,9 +888,9 @@
846 tree1.add('a')888 tree1.add('a')
847 tree1.commit('commit one')889 tree1.commit('commit one')
848 rev = repo.get_revision(branch1.revision_history()[0])890 rev = repo.get_revision(branch1.revision_history()[0])
849 datestring_first = format_date(rev.timestamp, rev.timezone)891 datestring_first = format_date(rev.timestamp, rev.timezone, local_weekday=True)
850 out, err = self.run_bzr('info -v repo/branch1')892 out, err = self.run_bzr('info -v repo/branch1')
851 self.assertEqualDiff(893 self.assertEqualDiff((
852"""Repository tree (format: knit)894"""Repository tree (format: knit)
853Location:895Location:
854 shared repository: repo896 shared repository: repo
@@ -881,12 +923,12 @@
881""" % (format.get_branch_format().get_format_description(),923""" % (format.get_branch_format().get_format_description(),
882 format.repository_format.get_format_description(),924 format.repository_format.get_format_description(),
883 datestring_first, datestring_first,925 datestring_first, datestring_first,
884 ), out)926 )).encode(bzrlib.user_encoding), out)
885 self.assertEqual('', err)927 self.assertEqual('', err)
886928
887 # Out of date second branch929 # Out of date second branch
888 out, err = self.run_bzr('info repo/branch2 --verbose')930 out, err = self.run_bzr('info repo/branch2 --verbose')
889 self.assertEqualDiff(931 self.assertEqualDiff((
890"""Repository tree (format: knit)932"""Repository tree (format: knit)
891Location:933Location:
892 shared repository: repo934 shared repository: repo
@@ -918,14 +960,14 @@
918 1 revision960 1 revision
919""" % (format.get_branch_format().get_format_description(),961""" % (format.get_branch_format().get_format_description(),
920 format.repository_format.get_format_description(),962 format.repository_format.get_format_description(),
921 ), out)963 )).encode(bzrlib.user_encoding), out)
922 self.assertEqual('', err)964 self.assertEqual('', err)
923965
924 # Update second branch966 # Update second branch
925 tree2 = branch2.bzrdir.open_workingtree()967 tree2 = branch2.bzrdir.open_workingtree()
926 tree2.pull(branch1)968 tree2.pull(branch1)
927 out, err = self.run_bzr('info -v repo/branch2')969 out, err = self.run_bzr('info -v repo/branch2')
928 self.assertEqualDiff(970 self.assertEqualDiff((
929"""Repository tree (format: knit)971"""Repository tree (format: knit)
930Location:972Location:
931 shared repository: repo973 shared repository: repo
@@ -961,12 +1003,12 @@
961""" % (format.get_branch_format().get_format_description(),1003""" % (format.get_branch_format().get_format_description(),
962 format.repository_format.get_format_description(),1004 format.repository_format.get_format_description(),
963 datestring_first, datestring_first,1005 datestring_first, datestring_first,
964 ), out)1006 )).encode(bzrlib.user_encoding), out)
965 self.assertEqual('', err)1007 self.assertEqual('', err)
9661008
967 # Show info about repository with revisions1009 # Show info about repository with revisions
968 out, err = self.run_bzr('info -v repo')1010 out, err = self.run_bzr('info -v repo')
969 self.assertEqualDiff(1011 self.assertEqualDiff((
970"""Shared repository with trees (format: dirstate or dirstate-tags or knit)1012"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
971Location:1013Location:
972 shared repository: repo1014 shared repository: repo
@@ -980,7 +1022,7 @@
980Repository:1022Repository:
981 1 revision1023 1 revision
982""" % (format.repository_format.get_format_description(),1024""" % (format.repository_format.get_format_description(),
983 ),1025 )).encode(bzrlib.user_encoding),
984 out)1026 out)
985 self.assertEqual('', err)1027 self.assertEqual('', err)
9861028
@@ -992,7 +1034,7 @@
992 repo = self.make_repository('repo', shared=True, format=format)1034 repo = self.make_repository('repo', shared=True, format=format)
993 repo.set_make_working_trees(True)1035 repo.set_make_working_trees(True)
994 out, err = self.run_bzr('info -v repo')1036 out, err = self.run_bzr('info -v repo')
995 self.assertEqualDiff(1037 self.assertEqualDiff((
996"""Shared repository with trees (format: dirstate or dirstate-tags or knit)1038"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
997Location:1039Location:
998 shared repository: repo1040 shared repository: repo
@@ -1006,7 +1048,7 @@
1006Repository:1048Repository:
1007 0 revisions1049 0 revisions
1008""" % (format.repository_format.get_format_description(),1050""" % (format.repository_format.get_format_description(),
1009 ), out)1051 )).encode(bzrlib.user_encoding), out)
1010 self.assertEqual('', err)1052 self.assertEqual('', err)
10111053
1012 # Create branch in root of repository1054 # Create branch in root of repository
@@ -1014,7 +1056,7 @@
1014 branch = control.create_branch()1056 branch = control.create_branch()
1015 control.create_workingtree()1057 control.create_workingtree()
1016 out, err = self.run_bzr('info -v repo')1058 out, err = self.run_bzr('info -v repo')
1017 self.assertEqualDiff(1059 self.assertEqualDiff((
1018"""Repository tree (format: knit)1060"""Repository tree (format: knit)
1019Location:1061Location:
1020 shared repository: repo1062 shared repository: repo
@@ -1043,7 +1085,7 @@
1043 0 revisions1085 0 revisions
1044""" % (format.get_branch_format().get_format_description(),1086""" % (format.get_branch_format().get_format_description(),
1045 format.repository_format.get_format_description(),1087 format.repository_format.get_format_description(),
1046 ), out)1088 )).encode(bzrlib.user_encoding), out)
1047 self.assertEqual('', err)1089 self.assertEqual('', err)
10481090
1049 def test_info_repository_hook(self):1091 def test_info_repository_hook(self):
@@ -1175,8 +1217,13 @@
1175 verbose_info = ' 0 committers\n'1217 verbose_info = ' 0 committers\n'
1176 else:1218 else:
1177 verbose_info = ''1219 verbose_info = ''
1220<<<<<<< TREE
11781221
1179 self.assertEqualDiff(1222 self.assertEqualDiff(
1223=======
1224
1225 self.assertEqualDiff((
1226>>>>>>> MERGE-SOURCE
1180"""%s (format: %s)1227"""%s (format: %s)
1181Location:1228Location:
1182%s%s1229%s%s
@@ -1210,7 +1257,7 @@
1210 lco_tree.branch.repository._format.get_format_description(),1257 lco_tree.branch.repository._format.get_format_description(),
1211 expected_lock_output,1258 expected_lock_output,
1212 verbose_info,1259 verbose_info,
1213 ), out)1260 )).encode(bzrlib.user_encoding), out)
1214 self.assertEqual('', err)1261 self.assertEqual('', err)
12151262
1216 def test_info_locking(self):1263 def test_info_locking(self):
@@ -1345,7 +1392,7 @@
13451392
1346 # U U U1393 # U U U
1347 out, err = self.run_bzr('info -v branch')1394 out, err = self.run_bzr('info -v branch')
1348 self.assertEqualDiff(1395 self.assertEqualDiff((
1349"""Standalone tree (format: weave)1396"""Standalone tree (format: weave)
1350Location:1397Location:
1351 branch root: %s1398 branch root: %s
@@ -1372,12 +1419,12 @@
1372Repository:1419Repository:
1373 0 revisions1420 0 revisions
1374""" % ('branch', tree.branch.repository._format.get_format_description(),1421""" % ('branch', tree.branch.repository._format.get_format_description(),
1375 ), out)1422 )).encode(bzrlib.user_encoding), out)
1376 self.assertEqual('', err)1423 self.assertEqual('', err)
1377 # L L L1424 # L L L
1378 tree.lock_write()1425 tree.lock_write()
1379 out, err = self.run_bzr('info -v branch')1426 out, err = self.run_bzr('info -v branch')
1380 self.assertEqualDiff(1427 self.assertEqualDiff((
1381"""Standalone tree (format: weave)1428"""Standalone tree (format: weave)
1382Location:1429Location:
1383 branch root: %s1430 branch root: %s
@@ -1404,7 +1451,7 @@
1404Repository:1451Repository:
1405 0 revisions1452 0 revisions
1406""" % ('branch', tree.branch.repository._format.get_format_description(),1453""" % ('branch', tree.branch.repository._format.get_format_description(),
1407 ), out)1454 )).encode(bzrlib.user_encoding), out)
1408 self.assertEqual('', err)1455 self.assertEqual('', err)
1409 tree.unlock()1456 tree.unlock()
14101457
14111458
=== modified file 'bzrlib/tests/blackbox/test_locale.py'
--- bzrlib/tests/blackbox/test_locale.py 2009-08-17 22:16:49 +0000
+++ bzrlib/tests/blackbox/test_locale.py 2009-08-31 04:38:49 +0000
@@ -18,6 +18,7 @@
1818
19import os19import os
20import sys20import sys
21import locale
2122
22from bzrlib.tests import TestCaseWithTransport, TestSkipped23from bzrlib.tests import TestCaseWithTransport, TestSkipped
2324
@@ -31,12 +32,13 @@
31 raise TestSkipped('Windows does not respond to the LANG'32 raise TestSkipped('Windows does not respond to the LANG'
32 ' env variable')33 ' env variable')
3334
35 self.comitter = u'\u062c\u0648\u062c\u0648 Meinel <juju@info.com>'
36 self.micro = u'\xb5'
34 tree = self.make_branch_and_tree('tree')37 tree = self.make_branch_and_tree('tree')
35 self.build_tree(['tree/a'])38 self.build_tree(['tree/a'])
36 tree.add('a')39 tree.add('a')
37 tree.commit(u'Unicode \xb5 commit', rev_id='r1',40 tree.commit(u'Unicode %s commit' % self.micro, rev_id='r1',
38 committer=u'\u062c\u0648\u062c\u0648'41 committer=self.comitter,
39 u' Meinel <juju@info.com>',
40 timestamp=1156451297.96, timezone=0)42 timestamp=1156451297.96, timezone=0)
41 self.tree = tree43 self.tree = tree
4244
@@ -44,7 +46,8 @@
44 out, err = self.run_bzr_subprocess(46 out, err = self.run_bzr_subprocess(
45 '--no-aliases --no-plugins log -q --log-format=long tree',47 '--no-aliases --no-plugins log -q --log-format=long tree',
46 env_changes={'LANG':'C', 'BZR_PROGRESS_BAR':'none',48 env_changes={'LANG':'C', 'BZR_PROGRESS_BAR':'none',
47 'LC_ALL':None, 'LC_CTYPE':None, 'LANGUAGE':None})49 'LC_ALL':None, 'LC_CTYPE':None, 'LC_TIME':None,
50 'LANGUAGE':None})
48 self.assertEqual('', err)51 self.assertEqual('', err)
49 self.assertEqualDiff("""\52 self.assertEqualDiff("""\
50------------------------------------------------------------53------------------------------------------------------------
@@ -56,6 +59,80 @@
56 Unicode ? commit59 Unicode ? commit
57""", out)60""", out)
5861
62 def _need_locale(self, test_locale, category=None):
63 if category is None:
64 self._need_locale(test_locale, locale.LC_COLLATE)
65 self._need_locale(test_locale, locale.LC_CTYPE)
66 self._need_locale(test_locale, locale.LC_MESSAGES)
67 self._need_locale(test_locale, locale.LC_MONETARY)
68 self._need_locale(test_locale, locale.LC_NUMERIC)
69 self._need_locale(test_locale, locale.LC_TIME)
70 else:
71 try:
72 old_locale = locale.setlocale(category, test_locale)
73 locale.setlocale(category, old_locale)
74 except locale.Error, e:
75 raise TestSkipped('Locale %s not supported' % test_locale)
76
77 def _test_locale(self, test_locale, thursdays, encoding="utf-8"):
78 self._need_locale(test_locale)
79 if isinstance(thursdays, (str, unicode)):
80 thursdays = [thursdays]
81 out, err = self.run_bzr_subprocess(
82 '--no-aliases --no-plugins info -q -v tree',
83 env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
84 self.assertEqual('', err)
85 out, err = self.run_bzr_subprocess(
86 '--no-aliases --no-plugins log -q --log-format=line tree',
87 env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
88 self.assertEqual('', err)
89 out, err = self.run_bzr_subprocess(
90 '--no-aliases --no-plugins log -q --log-format=short tree',
91 env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
92 self.assertEqual('', err)
93 out, err = self.run_bzr_subprocess(
94 '--no-aliases --no-plugins log -q --log-format=long tree',
95 env_changes={'BZR_PROGRESS_BAR':'none', 'LC_ALL':test_locale})
96 self.assertEqual('', err)
97 template = """\
98------------------------------------------------------------
99revno: 1
100committer: %s
101branch nick: tree
102timestamp: %s 2006-08-24 20:28:17 +0000
103message:
104 Unicode %s commit
105"""
106 comitter = self.comitter.encode(encoding, 'replace')
107 micro = self.micro.encode(encoding, 'replace')
108 for thursday in thursdays:
109 thursday = thursday.encode(encoding, 'replace')
110 if (template % (comitter, thursday, micro)) == out:
111 return
112 thursday = thursdays[0].encode(encoding, 'replace')
113 self.assertEqualDiff(template % (comitter, thursday, micro), out)
114
115 def test_latin1_de_DE(self):
116 self._test_locale("de_DE", "Do", "iso-8859-1")
117
118 def test_utf8_de_DE(self):
119 self._test_locale("de_DE.utf8", "Do")
120
121 def test_utf8_fr_FR(self):
122 self._test_locale("fr_FR.utf8", ["jeu.", "jeu"])
123
124 def test_utf8_es_ES(self):
125 self._test_locale("es_ES.utf8", "jue")
126
127 def test_utf8_ja_JP(self):
128 self._test_locale("ja_JP.utf8", u"\u6728")
129
130 def test_euc_ja_JP(self):
131 self._test_locale("ja_JP.EUC-JP", u"\u6728", "EUC-JP")
132
133 def test_utf8_ru_RU(self):
134 self._test_locale("ru_RU.utf8", u"\u0427\u0442\u0432")
135
59 def test_log_BOGUS(self):136 def test_log_BOGUS(self):
60 out, err = self.run_bzr_subprocess(137 out, err = self.run_bzr_subprocess(
61 '--no-aliases --no-plugins log -q --log-format=long tree',138 '--no-aliases --no-plugins log -q --log-format=long tree',
62139
=== modified file 'bzrlib/tests/test_log.py'
--- bzrlib/tests/test_log.py 2009-08-19 01:44:41 +0000
+++ bzrlib/tests/test_log.py 2009-08-31 04:38:49 +0000
@@ -17,6 +17,7 @@
17import os17import os
18from cStringIO import StringIO18from cStringIO import StringIO
1919
20<<<<<<< TREE
20from bzrlib import (21from bzrlib import (
21 errors,22 errors,
22 log,23 log,
@@ -47,6 +48,38 @@
47 To simplify testing we save logged revisions here rather than actually48 To simplify testing we save logged revisions here rather than actually
48 formatting anything, so that we can precisely check the result without49 formatting anything, so that we can precisely check the result without
49 being dependent on the formatting.50 being dependent on the formatting.
51=======
52from bzrlib import log
53from bzrlib.tests import TestCase, TestCaseWithTransport
54from bzrlib.log import (show_log,
55 get_view_revisions,
56 LogRevision,
57 LogFormatter,
58 LongLogFormatter,
59 ShortLogFormatter,
60 LineLogFormatter)
61from bzrlib.branch import Branch
62from bzrlib.errors import (
63 BzrCommandError,
64 InvalidRevisionNumber,
65 )
66from bzrlib.revision import Revision
67from bzrlib.revisionspec import (
68 RevisionInfo,
69 RevisionSpec,
70 )
71from bzrlib.osutils import format_date
72
73
74class LogCatcher(LogFormatter):
75 """Pull log messages into list rather than displaying them.
76
77 For ease of testing we save log messages here rather than actually
78 formatting them, so that we can precisely check the result without
79 being too dependent on the exact formatting.
80
81 We should also test the LogFormatter.
82>>>>>>> MERGE-SOURCE
50 """83 """
5184
52 supports_delta = True85 supports_delta = True
@@ -493,24 +526,39 @@
493 timestamp=1132711707,526 timestamp=1132711707,
494 timezone=36000,527 timezone=36000,
495 committer='Lorem Ipsum <test@example.com>')528 committer='Lorem Ipsum <test@example.com>')
529<<<<<<< TREE
496 logfile = file('out.tmp', 'w+')530 logfile = file('out.tmp', 'w+')
497 formatter = log.LongLogFormatter(to_file=logfile)531 formatter = log.LongLogFormatter(to_file=logfile)
498 log.show_log(b, formatter, verbose=True)532 log.show_log(b, formatter, verbose=True)
533=======
534 logfile = self.make_utf8_encoded_stringio()
535 formatter = LongLogFormatter(to_file=logfile)
536 show_log(b, formatter, verbose=True)
537>>>>>>> MERGE-SOURCE
499 logfile.flush()538 logfile.flush()
500 logfile.seek(0)539 logfile.seek(0)
501 log_contents = logfile.read()540 log_contents = logfile.read()
541<<<<<<< TREE
502 self.assertEqualDiff('''\542 self.assertEqualDiff('''\
543=======
544 self.assertEqualDiff(log_contents, ('''\
545>>>>>>> MERGE-SOURCE
503------------------------------------------------------------546------------------------------------------------------------
504revno: 1547revno: 1
505committer: Lorem Ipsum <test@example.com>548committer: Lorem Ipsum <test@example.com>
506branch nick: test_verbose_log549branch nick: test_verbose_log
507timestamp: Wed 2005-11-23 12:08:27 +1000550timestamp: %s
508message:551message:
509 add a552 add a
510added:553added:
511 a554 a
555<<<<<<< TREE
512''',556''',
513 log_contents)557 log_contents)
558=======
559''' % (format_date(1132711707, 36000, local_weekday=True)
560 )).encode('utf-8'))
561>>>>>>> MERGE-SOURCE
514562
515 def test_merges_are_indented_by_level(self):563 def test_merges_are_indented_by_level(self):
516 wt = self.make_branch_and_tree('parent')564 wt = self.make_branch_and_tree('parent')
@@ -628,14 +676,20 @@
628 wt = self.make_branch_and_tree('.')676 wt = self.make_branch_and_tree('.')
629 b = make_commits_with_trailing_newlines(wt)677 b = make_commits_with_trailing_newlines(wt)
630 sio = self.make_utf8_encoded_stringio()678 sio = self.make_utf8_encoded_stringio()
679<<<<<<< TREE
631 lf = log.LongLogFormatter(to_file=sio)680 lf = log.LongLogFormatter(to_file=sio)
632 log.show_log(b, lf)681 log.show_log(b, lf)
633 self.assertEqualDiff("""\682 self.assertEqualDiff("""\
683=======
684 lf = LongLogFormatter(to_file=sio)
685 show_log(b, lf)
686 self.assertEqualDiff(sio.getvalue(), ("""\
687>>>>>>> MERGE-SOURCE
634------------------------------------------------------------688------------------------------------------------------------
635revno: 3689revno: 3
636committer: Joe Foo <joe@foo.com>690committer: Joe Foo <joe@foo.com>
637branch nick: test691branch nick: test
638timestamp: Mon 2005-11-21 09:32:56 -0600692timestamp: %s
639message:693message:
640 single line with trailing newline694 single line with trailing newline
641------------------------------------------------------------695------------------------------------------------------------
@@ -643,7 +697,7 @@
643author: Joe Bar <joe@bar.com>697author: Joe Bar <joe@bar.com>
644committer: Joe Foo <joe@foo.com>698committer: Joe Foo <joe@foo.com>
645branch nick: test699branch nick: test
646timestamp: Mon 2005-11-21 09:27:22 -0600700timestamp: %s
647message:701message:
648 multiline702 multiline
649 log703 log
@@ -652,11 +706,18 @@
652revno: 1706revno: 1
653committer: Joe Foo <joe@foo.com>707committer: Joe Foo <joe@foo.com>
654branch nick: test708branch nick: test
655timestamp: Mon 2005-11-21 09:24:15 -0600709timestamp: %s
656message:710message:
657 simple log message711 simple log message
712<<<<<<< TREE
658""",713""",
659 sio.getvalue())714 sio.getvalue())
715=======
716""" % (format_date(1132587176.835228920, -6*3600, local_weekday=True),
717 format_date(1132586842.411175966, -6*3600, local_weekday=True),
718 format_date(1132586655.459960938, -6*3600, local_weekday=True)
719 )).encode('utf-8'))
720>>>>>>> MERGE-SOURCE
660721
661 def test_author_in_log(self):722 def test_author_in_log(self):
662 """Log includes the author name if it's set in723 """Log includes the author name if it's set in
@@ -671,6 +732,7 @@
671 timestamp=1132711707,732 timestamp=1132711707,
672 timezone=36000,733 timezone=36000,
673 committer='Lorem Ipsum <test@example.com>',734 committer='Lorem Ipsum <test@example.com>',
735<<<<<<< TREE
674 authors=['John Doe <jdoe@example.com>',736 authors=['John Doe <jdoe@example.com>',
675 'Jane Rey <jrey@example.com>'])737 'Jane Rey <jrey@example.com>'])
676 sio = StringIO()738 sio = StringIO()
@@ -1010,6 +1072,27 @@
10101072
10111073
1012class TestLineLogFormatter(tests.TestCaseWithTransport):1074class TestLineLogFormatter(tests.TestCaseWithTransport):
1075=======
1076 author='John Doe <jdoe@example.com>')
1077 sio = self.make_utf8_encoded_stringio()
1078 formatter = LongLogFormatter(to_file=sio)
1079 show_log(b, formatter)
1080 self.assertEqualDiff(sio.getvalue(), ('''\
1081------------------------------------------------------------
1082revno: 1
1083author: John Doe <jdoe@example.com>
1084committer: Lorem Ipsum <test@example.com>
1085branch nick: test_author_log
1086timestamp: %s
1087message:
1088 add a
1089''' % (format_date(1132711707, 36000, local_weekday=True)
1090 )).encode('utf-8'))
1091
1092
1093
1094class TestLineLogFormatter(TestCaseWithTransport):
1095>>>>>>> MERGE-SOURCE
10131096
1014 def test_line_log(self):1097 def test_line_log(self):
1015 """Line log should show revno1098 """Line log should show revno
10161099
=== modified file 'bzrlib/tests/test_selftest.py'
--- bzrlib/tests/test_selftest.py 2009-08-26 23:25:28 +0000
+++ bzrlib/tests/test_selftest.py 2009-08-31 04:38:49 +0000
@@ -865,6 +865,44 @@
865 self.assertEqual(lines[1], ' foo')865 self.assertEqual(lines[1], ' foo')
866 self.assertEqual(2, len(lines))866 self.assertEqual(2, len(lines))
867867
868<<<<<<< TREE
869=======
870 def test_text_report_known_failure(self):
871 # text test output formatting
872 pb = MockProgress()
873 result = bzrlib.tests.TextTestResult(
874 None,
875 descriptions=0,
876 verbosity=1,
877 pb=pb,
878 )
879 test = self.get_passing_test()
880 # this seeds the state to handle reporting the test.
881 result.startTest(test)
882 # the err parameter has the shape:
883 # (class, exception object, traceback)
884 # KnownFailures dont get their tracebacks shown though, so we
885 # can skip that.
886 err = (KnownFailure, KnownFailure('foo'), None)
887 result.report_known_failure(test, err)
888 self.assertEqual(
889 [
890 ('update', '[1 in 0s] passing_test', None, None),
891 ('note', '%s: %s\n %s\n', ('XFAIL', 'passing_test', err[1]))
892 ],
893 pb.calls)
894 # known_failures should be printed in the summary, so if we run a test
895 # after there are some known failures, the update prefix should match
896 # this.
897 result.known_failure_count = 3
898 test.run(result)
899 self.assertEqual(
900 [
901 ('update', '[2 in 0s] passing_test', None, None),
902 ],
903 pb.calls[2:])
904
905>>>>>>> MERGE-SOURCE
868 def get_passing_test(self):906 def get_passing_test(self):
869 """Return a test object that can't be run usefully."""907 """Return a test object that can't be run usefully."""
870 def passing_test():908 def passing_test():
871909
=== modified file 'bzrlib/timestamp.py'
--- bzrlib/timestamp.py 2009-03-23 14:59:43 +0000
+++ bzrlib/timestamp.py 2009-08-31 04:38:49 +0000
@@ -19,7 +19,6 @@
1919
20from bzrlib import osutils20from bzrlib import osutils
2121
22
23def format_highres_date(t, offset=0):22def format_highres_date(t, offset=0):
24 """Format a date, such that it includes higher precision in the23 """Format a date, such that it includes higher precision in the
25 seconds field.24 seconds field.
@@ -35,11 +34,11 @@
3534
36 >>> from bzrlib.osutils import format_date35 >>> from bzrlib.osutils import format_date
37 >>> format_date(1120153132.350850105, 0)36 >>> format_date(1120153132.350850105, 0)
38 'Thu 2005-06-30 17:38:52 +0000'37 u'Thu 2005-06-30 17:38:52 +0000'
39 >>> format_highres_date(1120153132.350850105, 0)38 >>> format_highres_date(1120153132.350850105, 0)
40 'Thu 2005-06-30 17:38:52.350850105 +0000'39 'Thu 2005-06-30 17:38:52.350850105 +0000'
41 >>> format_date(1120153132.350850105, -5*3600)40 >>> format_date(1120153132.350850105, -5*3600)
42 'Thu 2005-06-30 12:38:52 -0500'41 u'Thu 2005-06-30 12:38:52 -0500'
43 >>> format_highres_date(1120153132.350850105, -5*3600)42 >>> format_highres_date(1120153132.350850105, -5*3600)
44 'Thu 2005-06-30 12:38:52.350850105 -0500'43 'Thu 2005-06-30 12:38:52.350850105 -0500'
45 >>> format_highres_date(1120153132.350850105, 7200)44 >>> format_highres_date(1120153132.350850105, 7200)