Merge lp:~parthm/bzr/549310-mandatory-whoami into lp:bzr
| Status: | Merged |
|---|---|
| Approved by: | Parth Malwankar on 2010-05-05 |
| Approved revision: | 5197 |
| Merged at revision: | 5213 |
| Proposed branch: | lp:~parthm/bzr/549310-mandatory-whoami |
| Merge into: | lp:bzr |
| Diff against target: |
316 lines (+98/-83) 11 files modified
NEWS (+5/-0) bzrlib/config.py (+9/-80) bzrlib/errors.py (+7/-0) bzrlib/lockdir.py (+2/-2) bzrlib/osutils.py (+13/-0) bzrlib/tests/__init__.py (+1/-1) bzrlib/tests/blackbox/test_commit.py (+12/-0) bzrlib/tests/blackbox/test_init.py (+14/-0) bzrlib/tests/blackbox/test_shared_repository.py (+15/-0) bzrlib/tests/blackbox/test_whoami.py (+9/-0) bzrlib/tests/test_osutils.py (+11/-0) |
| To merge this branch: | bzr merge lp:~parthm/bzr/549310-mandatory-whoami |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Martin Pool | 2010-04-29 | Approve on 2010-05-05 | |
| Andrew Bennetts | 2010-04-27 | Needs Fixing on 2010-04-28 | |
| bzr-core | 2010-04-28 | Pending | |
|
Review via email:
|
|||
Commit Message
bzr does not guess whoami anymore. (parthm, #549310)
Description of the Change
=== Fixed Bug #549310 ===
This proposal make setting username mandatory either using 'bzr whoami', EMAIL or BZR_EMAIL.
bzr does not try to guess username as login@host as thats not very reliable.
Behavior change is that init, init-repo, commit, whoami throw error suggesting the use of 'bzr whoami'.
Explicit checks are added to init and init-repo to ensure that username is avoid creation of branch/repo directory by failing early. For making tests work, EMAIL has be set to <email address hidden> in the test environment.
E.g.
sandbox@
bzr: ERROR: Unable to determine your name.
Please, set your name with the 'whoami' command.
E.g. bzr whoami "Your Name <email address hidden>"
sandbox@
sandbox@
sandbox@
bzr: ERROR: Unable to determine your name.
Please, set your name with the 'whoami' command.
E.g. bzr whoami "Your Name <email address hidden>"
sandbox@
sandbox@
examples.desktop tmp
sandbox@
bzr: ERROR: Unable to determine your name.
Please, set your name with the 'whoami' command.
E.g. bzr whoami "Your Name <email address hidden>"
sandbox@
| Parth Malwankar (parthm) wrote : | # |
> It will be very nice to have this bug fixed.
>
> However, I don't think we should require whoami to be set to be able to use
> init-repo or init. Especially for init-repo there are valid use cases for it
> that don't require an identity to be set, e.g. mirroring a set of branches.
I was myself curious as to where/why init/init-repo need whoami to
be set. This patch merely ensures that they fail early before creating
a directory on disk.
So, it seems this info is used by lockdir to write it to lock file
so bzr know who has locked the dir. I suppose it maybe better to
keep whoami as mandatory in such a situation. Thoughts?
Following are the interesting parts of the stack trace without the
fail early change.
Traceback (most recent call last):
File "/storage/
return the_callable(*args, **kwargs)
File "/storage/
ret = run(*run_argv)
File "/storage/
return self.run(
File "/storage/
return self._operation
File "/storage/
self.cleanups, self.func, *args, **kwargs)
File "/storage/
result = func(*args, **kwargs)
File "/storage/
possible_
File "/storage/
bzrdir = BzrDir.create(base, format, possible_
File "/storage/
return format.
File "/storage/
return self._initializ
File "/storage/
control_
File "/storage/
token_from_lock = self._lock.
File "/storage/
return self.wait_lock()
File "/storage/
return self.attempt_lock()
File "/storage/
result = self._attempt_
File "/storage/
tmpname = self._create_
File "/storage/
| Andrew Bennetts (spiv) wrote : | # |
Parth Malwankar wrote:
> > It will be very nice to have this bug fixed.
> >
> > However, I don't think we should require whoami to be set to be able to use
> > init-repo or init. Especially for init-repo there are valid use cases for it
> > that don't require an identity to be set, e.g. mirroring a set of branches.
>
> I was myself curious as to where/why init/init-repo need whoami to
> be set. This patch merely ensures that they fail early before creating
> a directory on disk.
>
> So, it seems this info is used by lockdir to write it to lock file
> so bzr know who has locked the dir. I suppose it maybe better to
> keep whoami as mandatory in such a situation. Thoughts?
>
> Following are the interesting parts of the stack trace without the
> fail early change.
Ah!
I think for lockdirs it doesn't matter so much what the name is. It's
not a name that will be recorded permanently in the revision history,
it's just an indication for a concurrent user of that repo/branch/tree
of who has got the lock.
Ideally I think that for lockdirs:
* if the whoami is set, use that
* if the whoami isn't set, then the best-guess of the old
_auto_user_id code is good enough — that will almost certainly tell
whoever is looking at the lock file enough to figure out who created
the lock.
-Andrew.
| Martin Pool (mbp) wrote : | # |
On 28 April 2010 12:48, Andrew Bennetts <email address hidden> wrote:
> I think for lockdirs it doesn't matter so much what the name is. It's
> not a name that will be recorded permanently in the revision history,
> it's just an indication for a concurrent user of that repo/branch/tree
> of who has got the lock.
+1
>
> Ideally I think that for lockdirs:
>
> * if the whoami is set, use that
> * if the whoami isn't set, then the best-guess of the old
> _auto_user_id code is good enough — that will almost certainly tell
> whoever is looking at the lock file enough to figure out who created
> the lock.
even just putting the local username with no special tricks would be
enough. It's pretty transient.
--
Martin <http://
- 5193. By Parth Malwankar on 2010-04-28
-
lockdir no long mandates whoami but uses unicode version of getuser
| Robert Collins (lifeless) wrote : | # |
Well, lockdirs are exposed over the network, so if we have any host
info that is better than nothing.
| Martin Pool (mbp) wrote : | # |
On 28 April 2010 16:45, Robert Collins <email address hidden> wrote:
> Well, lockdirs are exposed over the network, so if we have any host
> info that is better than nothing.
I'm pretty sure the process hostname is already included in a separate field.
--
Martin <http://
- 5194. By Parth Malwankar on 2010-04-28
-
moved getuser_unicode to osutils.
- 5195. By Parth Malwankar on 2010-04-28
-
added tests for getuser_unicode
| Parth Malwankar (parthm) wrote : | # |
lockdir updated to use unicode version of getpass.getuser().
Added utility function osutils.
init/init-repo now work even when whoami is not set.
Added errors.NoWhoami.
| Parth Malwankar (parthm) wrote : | # |
The review comments here are closed. Maybe someone can give this a second look.
| Martin Pool (mbp) wrote : | # |
That looks good to me. Perhaps you could add comments to the tests for init and init-repo explaining why they're even tested, because it's a bit surprising they would ever fail.
- 5196. By Parth Malwankar on 2010-05-05
-
added comment to init/init-repo pass tests for lacking whoami.
- 5197. By Parth Malwankar on 2010-05-05
-
merged in changes from trunk.
| Parth Malwankar (parthm) wrote : | # |
> That looks good to me. Perhaps you could add comments to the tests for init
> and init-repo explaining why they're even tested, because it's a bit
> surprising they would ever fail.
Done. Thanks for the review.
All open comments on this are closed, so if another reviewer could give it a look and there is nothing more to do on this patch I could try to land it.
| Martin Pool (mbp) wrote : | # |
I think this is sufficiently reviewed and you can land at your leisure.
--
Martin <http://

It will be very nice to have this bug fixed.
However, I don't think we should require whoami to be set to be able to use init-repo or init. Especially for init-repo there are valid use cases for it that don't require an identity to be set, e.g. mirroring a set of branches.