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
1=== modified file 'shell.py'
2--- shell.py 2009-11-16 20:47:28 +0000
3+++ shell.py 2009-12-17 21:27:13 +0000
4@@ -137,14 +137,22 @@
5 self.prompt = "bzr%s> " % prompt
6
7 def set_title(self, command=None):
8- try:
9- b = Branch.open_containing('.')[0]
10- version = "%s:%d" % (b.nick, b.revno())
11- except:
12+ if self.tree is not None:
13+ version = "%s:%d" % (self.tree.branch.nick,
14+ self.tree.branch.revno())
15+ else:
16 version = "[no version]"
17 if command is None:
18 command = ""
19- sys.stdout.write(terminal.term_title("bzr %s %s" % (command, version)))
20+ if sys.platform == 'win32' and os.environ.get('TERM', '') == 'cygwin':
21+ # if we are running Win32 python, but we are running under a cygwin
22+ # shell, we can spawn 'sh.exe' and get it to set our title for us
23+ # Just writing to stdout is not enough
24+ os.system('sh -c "echo -ne \'\033]0;bzr shell %s %s\007\'"'
25+ % (command, version))
26+ else:
27+ sys.stdout.write(
28+ terminal.term_title("bzr %s %s" % (command, version)))
29
30 def do_cd(self, line):
31 if line == "":

Subscribers

People subscribed via source and target branches