From: W. Trevor King Date: Tue, 25 Nov 2008 03:03:20 +0000 (-0500) Subject: Hack to fixe encoding bug in becommands/show X-Git-Tag: 1.0.0~109 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0f3f492bd1c9db89b98f719f7371b183c9c8d838;p=be.git Hack to fixe encoding bug in becommands/show The situation really calls for a global encoding setting rather than lots of hardcoded "utf-8"s. See bug f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a --- 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 index 0000000..073f0b8 --- /dev/null +++ b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/body @@ -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 index 0000000..b0ecc8f --- /dev/null +++ b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/0fd8ba95-d9ea-49b3-9f5a-b0eb723cdbe1/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Tue, 25 Nov 2008 02:24:04 +0000 + + + + + + +From=W. Trevor King + + + 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 index 0000000..7f46872 --- /dev/null +++ b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body @@ -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 index 0000000..a93e649 --- /dev/null +++ b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values @@ -0,0 +1,28 @@ + + + +Content-type=text/plain + + + + + + +Date=Sat, 22 Nov 2008 21:43:29 +0000 + + + + + + +From=W. Trevor King + + + + + + +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 index 0000000..62c14e6 --- /dev/null +++ b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/body @@ -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 index 0000000..35b6806 --- /dev/null +++ b/.be/bugs/a403de79-8f39-41f2-b9ec-15053b175ee2/comments/25c67b0b-1afd-4613-a787-e0f018614966/values @@ -0,0 +1,28 @@ + + + +Content-type=text/plain + + + + + + +Date=Sun, 23 Nov 2008 12:37:57 +0000 + + + + + + +From=W. Trevor King + + + + + + +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 index 0000000..090895e --- /dev/null +++ b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/body @@ -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 index 0000000..8283996 --- /dev/null +++ b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/7dfdf230-231b-43e0-9b46-58d4d18eded1/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Tue, 25 Nov 2008 02:24:05 +0000 + + + + + + +From=W. Trevor King + + + diff --git a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values index 5aed729..84a0a11 100644 --- a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values +++ b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values @@ -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 index 0000000..d97791d --- /dev/null +++ b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/body @@ -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 + 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 index 0000000..f976972 --- /dev/null +++ b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/15602c0c-25e4-4c2c-9e24-79bdb90721b1/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Tue, 25 Nov 2008 02:36:16 +0000 + + + + + + +From=W. Trevor King + + + 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 index 0000000..7bb09ff --- /dev/null +++ b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/body @@ -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 index 0000000..bf5085b --- /dev/null +++ b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/comments/3f556a48-c538-4569-8609-3e829b561d78/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Tue, 25 Nov 2008 03:02:59 +0000 + + + + + + +From=W. Trevor King + + + diff --git a/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/values b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/values new file mode 100644 index 0000000..40ac06d --- /dev/null +++ b/.be/bugs/f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a/values @@ -0,0 +1,35 @@ + + + +creator=W. Trevor King + + + + + + +severity=minor + + + + + + +status=open + + + + + + +summary=UTF-8 encoding trouble with pipes in becommands/show + + + + + + +time=Tue, 25 Nov 2008 02:30:35 +0000 + + + diff --git a/becommands/diff.py b/becommands/diff.py index 77194ff..862afc5 100644 --- a/becommands/diff.py +++ b/becommands/diff.py @@ -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(): diff --git a/becommands/show.py b/becommands/show.py index abec813..45cd6ad 100644 --- a/becommands/show.py +++ b/becommands/show.py @@ -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 ...]")