Rev 3150: Fixed error reporting of unsupported timezone format (Lukas Lalinsky) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jan 2 09:22:08 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3150
revision-id:pqm at pqm.ubuntu.com-20080102092158-pz0zkj0mm2zbht1y
parent: pqm at pqm.ubuntu.com-20080102082344-qret383z2bdk1ud4
parent: ian.clatworthy at internode.on.net-20080102081623-x8s0mtabdg584tzy
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-01-02 09:21:58 +0000
message:
  Fixed error reporting of unsupported timezone format (Lukas Lalinsky)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
    ------------------------------------------------------------
    revno: 3148.1.1
    revision-id:ian.clatworthy at internode.on.net-20080102081623-x8s0mtabdg584tzy
    parent: pqm at pqm.ubuntu.com-20080102072122-nil0bpc9nxyp3tu4
    parent: lalinsky at gmail.com-20071227082504-xt6wuvwdpuody4f5
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: ianc-integration
    timestamp: Wed 2008-01-02 18:16:23 +1000
    message:
      Fixed error reporting of unsupported timezone format (Lukas Lalinsky)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
    ------------------------------------------------------------
    revno: 3144.1.1
    revision-id:lalinsky at gmail.com-20071227082504-xt6wuvwdpuody4f5
    parent: pqm at pqm.ubuntu.com-20071222080058-lra6luc153ex60w4
    committer: Lukáš Lalinský <lalinsky at gmail.com>
    branch nick: unsupported-timezone-format
    timestamp: Thu 2007-12-27 09:25:04 +0100
    message:
      Fixed error reporting of unsupported timezone format.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
=== modified file 'NEWS'
--- a/NEWS	2008-01-02 06:22:24 +0000
+++ b/NEWS	2008-01-02 08:16:23 +0000
@@ -64,6 +64,9 @@
    * ``commit`` now succeeds when a checkout and its master branch share a
      repository.  (Aaron Bentley, #177592)
 
+   * Fixed error reporting of unsupported timezone format in
+     ``log --timezone``. (Lukáš Lalinský, #178722)
+
    * Fixed Unicode encoding error in ``ignored`` when the output is
      redirected to a pipe. (Lukáš Lalinský)
 

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2007-12-20 00:56:46 +0000
+++ b/bzrlib/errors.py	2007-12-27 08:25:04 +0000
@@ -2515,3 +2515,12 @@
                 path_str = repr(path)
             path_str += ' '
         self.path_str = path_str
+
+
+class UnsupportedTimezoneFormat(BzrError):
+
+    _fmt = ('Unsupported timezone format "%(timezone)s", '
+            'options are "utc", "original", "local".')
+
+    def __init__(self, timezone):
+        self.timezone = timezone

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2007-12-19 02:44:29 +0000
+++ b/bzrlib/osutils.py	2007-12-27 08:25:04 +0000
@@ -670,8 +670,7 @@
         tt = time.localtime(t)
         offset = local_time_offset(t)
     else:
-        raise errors.BzrError("unsupported timezone format %r" % timezone,
-                              ['options are "utc", "original", "local"'])
+        raise errors.UnsupportedTimezoneFormat(timezone)
     if date_fmt is None:
         date_fmt = "%a %Y-%m-%d %H:%M:%S"
     if show_offset:

=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py	2007-12-15 13:11:12 +0000
+++ b/bzrlib/tests/blackbox/test_log.py	2007-12-27 08:25:04 +0000
@@ -80,6 +80,12 @@
         self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.',
                            ['log', '-r-2..0'])
 
+    def test_log_unsupported_timezone(self):
+        self._prepare()
+        self.run_bzr_error('bzr: ERROR: Unsupported timezone format "foo", '
+                           'options are "utc", "original", "local".',
+                           ['log', '--timezone', 'foo'])
+
     def test_log_negative_begin_revspec_full_log(self):
         self._prepare()
         log = self.run_bzr("log -r -3..")[0]

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2007-12-11 06:48:09 +0000
+++ b/bzrlib/tests/test_osutils.py	2007-12-27 08:25:04 +0000
@@ -260,6 +260,10 @@
         self.assertFormatedDelta('1 second in the future', -1)
         self.assertFormatedDelta('2 seconds in the future', -2)
 
+    def test_format_date(self):
+        self.assertRaises(errors.UnsupportedTimezoneFormat,
+            osutils.format_date, 0, timezone='foo')
+
     def test_dereference_path(self):
         self.requireFeature(SymlinkFeature)
         cwd = osutils.realpath('.')




More information about the bazaar-commits mailing list