{"thread":{"id":"43143","subject":"Re: [PATCH] Print progress message to stderr, not stdout","startedAt":"2006-11-11T12:16:25Z","lastAt":"2006-12-05T09:06:56Z","messageCount":10,"participants":["Johannes Schindelin","Catalin Marinas","Karl Hasselström","Marco Costalba"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"294613","messageId":"20061111121625.8988.45195.stgit@localhost","threadId":"43143","inReplyTo":null,"subject":"[PATCH] Print progress message to stderr, not stdout","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-11T12:16:25Z","receivedAt":"2006-11-11T12:16:25Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Printing progress messages to stdout causes them to get mixed up with\nthe actual output of the program. Using stderr is much better, since\nthe user can then redirect the two components separately.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\nI noticed this when creating a patch with \"stg export -s\" for the\nimport regression test.\n\n stgit/git.py |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/stgit/git.py b/stgit/git.py\nindex 2a6ae91..8d88769 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -186,8 +186,8 @@ def __tree_status(files = None, tree_id\n     \"\"\"Returns a list of pairs - [status, filename]\n     \"\"\"\n     if verbose:\n-        print 'Checking for changes in the working directory...',\n-        sys.stdout.flush()\n+        sys.stderr.write('Checking for changes in the working directory...')\n+        sys.stderr.flush()\n \n     refresh_index()\n \n@@ -226,7 +226,7 @@ def __tree_status(files = None, tree_id\n             cache_files.append(fs)\n \n     if verbose:\n-        print 'done'\n+        print >> sys.stderr, 'done'\n \n     return cache_files\n"},{"id":"295915","messageId":"e5bfff550612020520w3ad48a09xfdde63b9050a75cf@mail.gmail.com","threadId":"43143","inReplyTo":"20061111121625.8988.45195.stgit@localhost","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-12-02T13:20:07Z","receivedAt":"2006-12-02T13:20:07Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 11/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> Printing progress messages to stdout causes them to get mixed up with\n> the actual output of the program. Using stderr is much better, since\n> the user can then redirect the two components separately.\n>\n\nThis patch breaks qgit.\n\nGUI interface to stgit pop and push commands is broken because a\ncommand that prints to stderr is considered a failing one by qgit.\n\nI would kindly ask you to:\n\n1 - Revert the patch. That would be the best. You can use a prefix to\nprinted message instead, see git pull, something like 'stg: bla bla\nbla' . In any case, IMHO, using stderr for normal activity logging\ndoes not sound like a great idea in general.\n\n2 - At least add a '-v' '--verbose' option that defaults to quiet so\nto not break back compatibility.\n\n\nThanks\nMarco\n\nP.S: I cannot change the stderr == 'something has gone wrong'\nbehaviour because the interface to git commands works with this, and,\nBTW, _all_ the git commands respect the behaviour stderr == empty ->\n"},{"id":"296364","messageId":"b0943d9e0612040117y6554b891yaf6eb59d0d52ebf0@mail.gmail.com","threadId":"43143","inReplyTo":"e5bfff550612020520w3ad48a09xfdde63b9050a75cf@mail.gmail.com","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-12-04T09:17:16Z","receivedAt":"2006-12-04T09:17:16Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 02/12/06, Marco Costalba <mcostalba@gmail.com> wrote:\n> On 11/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> > Printing progress messages to stdout causes them to get mixed up with\n> > the actual output of the program. Using stderr is much better, since\n> > the user can then redirect the two components separately.\n>\n> This patch breaks qgit.\n>\n> GUI interface to stgit pop and push commands is broken because a\n> command that prints to stderr is considered a failing one by qgit.\n>\n> I would kindly ask you to:\n>\n> 1 - Revert the patch. That would be the best. You can use a prefix to\n> printed message instead, see git pull, something like 'stg: bla bla\n> bla' . In any case, IMHO, using stderr for normal activity logging\n> does not sound like a great idea in general.\n>\n> 2 - At least add a '-v' '--verbose' option that defaults to quiet so\n> to not break back compatibility.\n\nSince there are other tools relying on a clean stderr, I think I would\nrevert it and add a verbose flag and/or config option. Karl, any\nthoughts on this (since you sent the patch)?\n\n-- \n"},{"id":"297071","messageId":"20061204153705.GA8644@diana.vm.bytemark.co.uk","threadId":"43143","inReplyTo":"b0943d9e0612040117y6554b891yaf6eb59d0d52ebf0@mail.gmail.com","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-12-04T15:37:05Z","receivedAt":"2006-12-04T15:37:05Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-12-04 09:17:16 +0000, Catalin Marinas wrote:\n\n> On 02/12/06, Marco Costalba <mcostalba@gmail.com> wrote:\n>\n> > On 11/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> >\n> > > Printing progress messages to stdout causes them to get mixed up\n> > > with the actual output of the program. Using stderr is much\n> > > better, since the user can then redirect the two components\n> > > separately.\n> >\n> > This patch breaks qgit.\n>\n> Since there are other tools relying on a clean stderr, I think I\n> would revert it and add a verbose flag and/or config option. Karl,\n> any thoughts on this (since you sent the patch)?\n\nI introduced this since I wanted to divert the output to a file, and\nthe progress message had no business being written to that file. But a\ncommand line option to suppress progress messages would work just as\nwell if that's what git does.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"296775","messageId":"e5bfff550612041034g727a1bebg464f7c523c0fac7f@mail.gmail.com","threadId":"43143","inReplyTo":"20061204153705.GA8644@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-12-04T18:34:59Z","receivedAt":"2006-12-04T18:34:59Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 12/4/06, Karl Hasselström <kha@treskal.com> wrote:\n> On 2006-12-04 09:17:16 +0000, Catalin Marinas wrote:\n>\n> > On 02/12/06, Marco Costalba <mcostalba@gmail.com> wrote:\n> >\n> > > On 11/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> > >\n> > > > Printing progress messages to stdout causes them to get mixed up\n> > > > with the actual output of the program. Using stderr is much\n> > > > better, since the user can then redirect the two components\n> > > > separately.\n> > >\n> > > This patch breaks qgit.\n> >\n> > Since there are other tools relying on a clean stderr, I think I\n> > would revert it and add a verbose flag and/or config option. Karl,\n> > any thoughts on this (since you sent the patch)?\n>\n> I introduced this since I wanted to divert the output to a file, and\n> the progress message had no business being written to that file. But a\n> command line option to suppress progress messages would work just as\n> well if that's what git does.\n>\n\nIf you don't mind I would prefer a command line option to _enable_\nprogress messages, something like -v or --verbose so to keep back\ncompatibility with current versions of tools that do not expect stderr\nmessages.\n\nThanks\n"},{"id":"295790","messageId":"b0943d9e0612041413p4f303176x3d0fa95afd1c4a1@mail.gmail.com","threadId":"43143","inReplyTo":"e5bfff550612041034g727a1bebg464f7c523c0fac7f@mail.gmail.com","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-12-04T22:13:16Z","receivedAt":"2006-12-04T22:13:16Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 04/12/06, Marco Costalba <mcostalba@gmail.com> wrote:\n> On 12/4/06, Karl Hasselström <kha@treskal.com> wrote:\n> > I introduced this since I wanted to divert the output to a file, and\n> > the progress message had no business being written to that file. But a\n> > command line option to suppress progress messages would work just as\n> > well if that's what git does.\n>\n> If you don't mind I would prefer a command line option to _enable_\n> progress messages, something like -v or --verbose so to keep back\n> compatibility with current versions of tools that do not expect stderr\n> messages.\n\nI'll first move the message back to stdout. Does qgit rely on the\nStGIT output to have a certain format/information? Does the progress\nmessage affect it in any way?\n\nI consider many of the other messages to be progress messages (like\n\"pushing... done\") and I haven't differentiated between them until\nKarl's patch. For commands like diff or status, you expect the command\nto check the working copy anyway and it doesn't output this specific\nmessage.\n\nThe best would probably be to add a \"verbose\" config option to enable\nthis message (and maybe a command line option later but this means\nmodifying all the commands to accept this option). I'll try to push\nthis change tomorrow (together with moving from stgitrc to gitconfig).\n\n-- \n"},{"id":"295550","messageId":"e5bfff550612042211q4c4e1e79x8e6e08a224209135@mail.gmail.com","threadId":"43143","inReplyTo":"b0943d9e0612041413p4f303176x3d0fa95afd1c4a1@mail.gmail.com","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-12-05T06:11:04Z","receivedAt":"2006-12-05T06:11:04Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 12/4/06, Catalin Marinas <catalin.marinas@gmail.com> wrote:\n> On 04/12/06, Marco Costalba <mcostalba@gmail.com> wrote:\n> > On 12/4/06, Karl Hasselström <kha@treskal.com> wrote:\n> > > I introduced this since I wanted to divert the output to a file, and\n> > > the progress message had no business being written to that file. But a\n> > > command line option to suppress progress messages would work just as\n> > > well if that's what git does.\n> >\n> > If you don't mind I would prefer a command line option to _enable_\n> > progress messages, something like -v or --verbose so to keep back\n> > compatibility with current versions of tools that do not expect stderr\n> > messages.\n>\n> I'll first move the message back to stdout. Does qgit rely on the\n> StGIT output to have a certain format/information? Does the progress\n> message affect it in any way?\n>\n\nNo. It just checks stderr for empty.\n\nThe only commands whose output is used by qgit are stg series/applied/u"},{"id":"293913","messageId":"Pine.LNX.4.63.0612050841160.28348@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43143","inReplyTo":"b0943d9e0612041413p4f303176x3d0fa95afd1c4a1@mail.gmail.com","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-12-05T07:41:57Z","receivedAt":"2006-12-05T07:41:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Dec 2006, Catalin Marinas wrote:\n\n> I'll first move the message back to stdout.\n\nIn other parts of git, the progress message is only printed if output goes \nto a tty. Why not do the same?\n\nCiao,\nDscho\n"},{"id":"297240","messageId":"20061205090608.GA25002@diana.vm.bytemark.co.uk","threadId":"43143","inReplyTo":"Pine.LNX.4.63.0612050841160.28348@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-12-05T09:06:08Z","receivedAt":"2006-12-05T09:06:08Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-12-05 08:41:57 +0100, Johannes Schindelin wrote:\n\n> On Mon, 4 Dec 2006, Catalin Marinas wrote:\n>\n> > I'll first move the message back to stdout.\n>\n> In other parts of git, the progress message is only printed if\n> output goes to a tty. Why not do the same?\n\nThat sounds like a good idea for two reasons:\n\n  1. It will address all concerns raised in this thread (I think).\n\n  2. It will remove an unnecessary difference between git and stgit.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"293941","messageId":"b0943d9e0612050106k1081813ds98aec9272174a9ae@mail.gmail.com","threadId":"43143","inReplyTo":"Pine.LNX.4.63.0612050841160.28348@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Print progress message to stderr, not stdout","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-12-05T09:06:56Z","receivedAt":"2006-12-05T09:06:56Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 05/12/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Mon, 4 Dec 2006, Catalin Marinas wrote:\n> > I'll first move the message back to stdout.\n>\n> In other parts of git, the progress message is only printed if output goes\n> to a tty. Why not do the same?\n\nThanks for the hint. This seems to me like the easiest solution.\n\n-- \n"}]}