Merge lp://qastaging/~jameinel/bzrtools/cygwin-title into lp://qastaging/bzrtools

Proposed by John A Meinel
Status: Rejected
Rejected by: Aaron Bentley
Proposed branch: lp://qastaging/~jameinel/bzrtools/cygwin-title
Merge into: lp://qastaging/bzrtools
Diff against target: 31 lines (+13/-5)
1 file modified
shell.py (+13/-5)
To merge this branch: bzr merge lp://qastaging/~jameinel/bzrtools/cygwin-title
Reviewer Review Type Date Requested Status
Aaron Bentley Disapprove
Review via email: mp+16308@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This adds support for setting the title bar if you are running native win32 python under a cygwin terminal.

I'm happy to tweak it as you see fit, but this has been useful for me. Since it allows me to start a shell, and figure out which one that is by looking at the title bars.

Revision history for this message
Aaron Bentley (abentley) wrote :

It looks like this changes the title string so that it says "bzr shell" instead of "bzr", but only in Cygwin. I'm happy with the change, but it seems strange to do it only in Cygwin. Why not use the same title string in both?

review: Needs Information
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> Review: Needs Information
> It looks like this changes the title string so that it says "bzr shell" instead of "bzr", but only in Cygwin. I'm happy with the change, but it seems strange to do it only in Cygwin. Why not use the same title string in both?

Because I wanted it to say 'bzr shell' for me, but didn't want to affect
your default (for whatever reason you chose it).

Though I've since customized it significantly more, and would probably
just have my own plugin that monkeypatches things to match what I want.
(Since I don't really feel like putting the effort into making it
actually configurable like $PS1 is.)

If you'd rather I made it say 'bzr' or 'bzr shell' both places, I'm fine
with that.

John
=:>-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksq4UkACgkQJdeBCYSNAAPPcQCgxViylTJfmmG3z0yF7APYWRM0
vZwAn0SinrV0cnBY53do/VATfnmML4jH
=Tsea
-----END PGP SIGNATURE-----

Revision history for this message
Aaron Bentley (abentley) wrote :

> If you'd rather I made it say 'bzr' or 'bzr shell' both places, I'm fine
> with that.

That would be great.

review: Needs Fixing
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> Review: Needs Fixing
>> If you'd rather I made it say 'bzr' or 'bzr shell' both places, I'm fine
>> with that.
>
> That would be great.

Do you have a preference as to which?
John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksrFfAACgkQJdeBCYSNAAO7cACgpgcNAWZHTSuVEwTnofCjSavw
Dz0An0Jq4Tk/MoXd9qbbOlMS1KFymdwL
=jByd
-----END PGP SIGNATURE-----

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Aaron, ping?

Revision history for this message
Aaron Bentley (abentley) wrote :

Rejecting as agreed with JAM

review: Disapprove

Unmerged revisions

739. By John A Meinel

Word wrap appropriately

738. By John A Meinel

Allow setting the title in a cygwin terminal.

Even if we are running native python, we can still call out to cygwin.
And we know that is safe, because otherwise we wouldn't have TERM set.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'shell.py'
--- shell.py 2009-11-16 20:47:28 +0000
+++ shell.py 2009-12-17 21:27:13 +0000
@@ -137,14 +137,22 @@
137 self.prompt = "bzr%s> " % prompt137 self.prompt = "bzr%s> " % prompt
138138
139 def set_title(self, command=None):139 def set_title(self, command=None):
140 try:140 if self.tree is not None:
141 b = Branch.open_containing('.')[0]141 version = "%s:%d" % (self.tree.branch.nick,
142 version = "%s:%d" % (b.nick, b.revno())142 self.tree.branch.revno())
143 except:143 else:
144 version = "[no version]"144 version = "[no version]"
145 if command is None:145 if command is None:
146 command = ""146 command = ""
147 sys.stdout.write(terminal.term_title("bzr %s %s" % (command, version)))147 if sys.platform == 'win32' and os.environ.get('TERM', '') == 'cygwin':
148 # if we are running Win32 python, but we are running under a cygwin
149 # shell, we can spawn 'sh.exe' and get it to set our title for us
150 # Just writing to stdout is not enough
151 os.system('sh -c "echo -ne \'\033]0;bzr shell %s %s\007\'"'
152 % (command, version))
153 else:
154 sys.stdout.write(
155 terminal.term_title("bzr %s %s" % (command, version)))
148156
149 def do_cd(self, line):157 def do_cd(self, line):
150 if line == "":158 if line == "":

Subscribers

People subscribed via source and target branches