Hack to fixe encoding bug in becommands/show
authorW. Trevor King <wking@drexel.edu>
Tue, 25 Nov 2008 03:03:20 +0000 (22:03 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 25 Nov 2008 03:03:20 +0000 (22:03 -0500)
The situation really calls for a global encoding setting rather than
lots of hardcoded "utf-8"s.  See bug
  f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a

16 files changed:
.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/body [new file with mode: 0644]
.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/values [new file with mode: 0644]
.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body [new file with mode: 0644]
.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values [new file with mode: 0644]
.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/body [new file with mode: 0644]
.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/values [new file with mode: 0644]
.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/body [new file with mode: 0644]
.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/values [new file with mode: 0644]
.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values
.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/body [new file with mode: 0644]
.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/values [new file with mode: 0644]
.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/body [new file with mode: 0644]
.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/values [new file with mode: 0644]
.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/values [new file with mode: 0644]
becommands/diff.py
becommands/show.py

diff --git a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/body b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/body
new file mode 100644 (file)
index 0000000..073f0b8
--- /dev/null
@@ -0,0 +1 @@
+Merged from bug c894f10f-197d-4b22-9c5b-19f394df40d4
\ No newline at end of file
diff --git a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/values b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/values
new file mode 100644 (file)
index 0000000..b0ecc8f
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Tue, 25 Nov 2008 02:24:04 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
diff --git a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body
new file mode 100644 (file)
index 0000000..7f46872
--- /dev/null
@@ -0,0 +1,17 @@
+Example:
+
+We're working happily in a versioned bugdir, and our RCS knows who we
+are.  We create a temporary repository copy from a previous revision
+for diff generation.  We set the RCS for the copy to "None", since we
+didn't bother initializing our normal RCS in the snapshot copy.  But
+now the BugDir instantized on the copy doesn't know who we are!
+
+Solution:
+
+Track user id in the bugdir settings file.  If you
+bugdir.settings["user_id"], it will be saved and loaded.  When loaded,
+it will also set bugdir.user_id.  If you set rcs.user_id, it will be
+returned by rcs.get_user_id(), instead of returing the output of
+rcs._rcs_get_user_id().  We should be caching the output of
+_rcs_get_user_id() anyway.
+
diff --git a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values
new file mode 100644 (file)
index 0000000..a93e649
--- /dev/null
@@ -0,0 +1,28 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Sat, 22 Nov 2008 21:43:29 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
+
+
+
+In-reply-to=0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1
+
+
+
diff --git a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/body b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/body
new file mode 100644 (file)
index 0000000..62c14e6
--- /dev/null
@@ -0,0 +1 @@
+This bug duplicates a403de79-8f39-41f2-b9ec-15053b175ee2
diff --git a/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/values b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/values
new file mode 100644 (file)
index 0000000..35b6806
--- /dev/null
@@ -0,0 +1,28 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Sun, 23 Nov 2008 12:37:57 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
+
+
+
+In-reply-to=0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1
+
+
+
diff --git a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/body b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/body
new file mode 100644 (file)
index 0000000..090895e
--- /dev/null
@@ -0,0 +1 @@
+Merged into bug a403de79-8f39-41f2-b9ec-15053b175ee2
\ No newline at end of file
diff --git a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/values b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/values
new file mode 100644 (file)
index 0000000..8283996
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Tue, 25 Nov 2008 02:24:05 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
index 5aed7295198c4f7292b3dfd1d0565bc0922e6b9c..84a0a118d34595d5918627fdcbd07344e1d27ddd 100644 (file)
@@ -15,7 +15,7 @@ severity=minor
 
 
 
-status=fixed
+status=closed
 
 
 
diff --git a/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/body b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/body
new file mode 100644 (file)
index 0000000..d97791d
--- /dev/null
@@ -0,0 +1,14 @@
+$ be show 31cd490d-a1c2-4ab3-8284-d80395e34dd2
+
+works as expected, but
+
+$ be show 31cd490d-a1c2-4ab3-8284-d80395e34dd2 | grep something
+Traceback (most recent call last):
+  File "/home/wking/bin/be", line 30, in <module>
+    sys.exit(cmdutil.execute(sys.argv[1], sys.argv[2:]))
+  File "/home/wking/src/fun/be-bugfix/libbe/cmdutil.py", line 57, in execute
+  File "/home/wking/src/fun/be/be.wtk/becommands/show.py", line 44, in execute
+    print bug.string(show_comments=True)
+UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 2100: ordinal not in range(128)
+
+By the way, u2019 is a fancy apostrophe.
diff --git a/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/values b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/values
new file mode 100644 (file)
index 0000000..f976972
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Tue, 25 Nov 2008 02:36:16 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
diff --git a/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/body b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/body
new file mode 100644 (file)
index 0000000..7bb09ff
--- /dev/null
@@ -0,0 +1,9 @@
+Solution here
+http://www.amk.ca/python/howto/unicode
+
+You need to encode before printing.
+
+This is unfortunate, because we're currently very glib about just
+printing info to the terminal.  This makes it much more important to
+have a single bugdir-wide encoding specification...
+
diff --git a/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/values b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/values
new file mode 100644 (file)
index 0000000..bf5085b
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Tue, 25 Nov 2008 03:02:59 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
diff --git a/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/values b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/values
new file mode 100644 (file)
index 0000000..40ac06d
--- /dev/null
@@ -0,0 +1,35 @@
+
+
+
+creator=W. Trevor King <wking@drexel.edu>
+
+
+
+
+
+
+severity=minor
+
+
+
+
+
+
+status=open
+
+
+
+
+
+
+summary=UTF-8 encoding trouble with pipes in becommands/show
+
+
+
+
+
+
+time=Tue, 25 Nov 2008 02:30:35 +0000
+
+
+
index 77194ffde6373357fa7dfbfba18e21cc0351cc6a..862afc5b2bb2a7226aca580f1a66a09cab09946f 100644 (file)
@@ -54,6 +54,7 @@ def execute(args):
         old_bd = bd.duplicate_bugdir(revision)
         r,m,a = diff.diff(old_bd, bd)
         diff.diff_report((r,m,a), bd)
+        # TODO, string return from diff report
         bd.remove_duplicate_bugdir()
 
 def get_parser():
index abec81319cb959951581dea54eecc20dd0fe99d8..45cd6ad00a30fd829e3e4170f2c9dfa05599e08a 100644 (file)
@@ -41,7 +41,7 @@ def execute(args):
     bd = bugdir.BugDir(from_disk=True)
     for bugid in args:
         bug = bd.bug_from_shortname(bugid)
-        print bug.string(show_comments=True)
+        print bug.string(show_comments=True).encode('utf-8')
 
 def get_parser():
     parser = cmdutil.CmdOptionParser("be show BUG-ID [BUG-ID ...]")