Support multiple server instances better.

Registered by Thomi Richards on 2011-08-12

Currently our bzr-sloecode plugin works out how to translate a short URI (e.g.- sc:projectname) into a full URL using two pieces of information:

 * The contents of the SLOECODE_SERVER environment variable
 * The configured sloecode login, or the current system uername, if sc-login has not been set.

The username configured with sc-login is tied to the currently set server, although this does not work perfectly. or example:

# set server and uername for the first instace:
thomi@pinch:~/code$ export SLOECODE_SERVER=192.168.1.1
thomi@pinch:~/code$ bzr sc-login
No Sloecode user ID configured.
thomi@pinch:~/code$ bzr sc-login username_a
thomi@pinch:~/code$ bzr sc-login
username_a

# now set server to some other instance - not that previous username is forgotten when we do this (good):
thomi@pinch:~/code$ export SLOECODE_SERVER=some.other.server.com
thomi@pinch:~/code$ bzr sc-login
No Sloecode user ID configured.
thomi@pinch:~/code$ bzr sc-login username_b
thomi@pinch:~/code$ bzr sc-login
username_b

# Now set back to original server. Username is not remembered from previous call to sc-login (bad):
thomi@pinch:~/code$ export SLOECODE_SERVER=192.168.1.1
thomi@pinch:~/code$ bzr sc-login
No Sloecode user ID configured.

Fixing this behavior such that the username from the first instance is remembered would make the bzr-sloecode plugin a lot more usable for people running multiple server instances. However, I still don't like using an environment variable to store the current server:

 * It's hard to change - if you want to change it permanently, or you want the change to persist over multiple shells you need to edit your .bashrc file, or edit the environment variable under Windows (which is a real PITA).
 * It'd be nicer to have a single bzr command that set up everything you need to get going with sloecode.

I propose a change to the bzr-sloecode plugin that adds a command "sc-switch". I imagine it's usage might be something like this:

bzr sc-switch SERVER_INSTANCE [USERNAME]

Calling "sc-switch some.server.address.com username" sets the current server instance to the address provided, and stores the username provided with this server. Username and server address expansion happens as expected.

Calling "sc-switch SERVER_INSTANCE" Sets the server address only. If you have previously specified a username when switching to this server, that username will be remembered and used for this server. If you have never specified a username, your current system login will be used.

For each call, the command should print something like:

 * "Switching to bzr server {SERVER_INSTANCE} with username {USERNAME}"
 * "Switching to bzr server {SERVER_INSTANCE} with system username"

Finally, there's probably a good case to be made for showing some informational message when one runs "bzr sc-switch" with no arguments, something like "Currently using bzr server {SERVER_INSTANCE} with username {USERNAME}" etc.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Discussion
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.