NoSuchRevision traceback when given revid is not in the default merge source

Bug #395906 reported by Guy K. Kloss
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

On merging a specific revision, "bzr merge" crashes when omitting a mandatory (and important) command line argument (the final path argument "." for the current directory).

See http://pastebin.ubuntu.com/210699/

Worked flawlessly with the correct command line.

The application should report the omission gracefully, and not error out with an exception and stack trace dump to the user level on this, I believe.

Configuration:
 * bzr: 1.16.1
 * bzr-svn plugin: 0.6.2
 * Python 2.6.2 on Ubuntu Jaunty

gkloss@it041227:~/Publications$ bzr merge -r revid:gkloss@it041227-20090705203722-z1cliuv0skxfqltb
Merging from remembered submit location https://<email address hidden>/svn/publications/trunk
bzr: ERROR: bzrlib.errors.NoSuchRevision: <bzrlib.plugins.svn.cache.tdbcache.RevisionIdMapCache object at 0xb65061ac> has no revision gkloss@it041227-20090705203722-z1cliuv0skxfqltb

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 729, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 924, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 560, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/qbzr/lib/commands.py", line 632, in run
    return bzrlib.builtins.cmd_merge.run(self, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 3573, in run
    location, revision, remember, possible_transports, pb)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 3680, in _get_merger_from_branch
    other_revision_id, base_revision_id, other_branch, base_branch)
  File "/usr/lib/python2.6/dist-packages/bzrlib/merge.py", line 204, in from_revision_ids
    merger.set_other_revision(other, other_branch)
  File "/usr/lib/python2.6/dist-packages/bzrlib/merge.py", line 345, in set_other_revision
    self._maybe_fetch(other_branch, self.this_branch, self.other_rev_id)
  File "/usr/lib/python2.6/dist-packages/bzrlib/merge.py", line 362, in _maybe_fetch
    target.fetch(source, revision_id)
  File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 532, in fetch
    pb=pb)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 1553, in fetch
    find_ghosts=find_ghosts, fetch_spec=fetch_spec)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/svn/fetch.py", line 1227, in fetch
    foreign_revid, mapping = self.source.lookup_revision_id(revision_id, project=project)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/svn/repository.py", line 953, in lookup_revision_id
    return self.revmap.get_branch_revnum(revid, layout, project)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/svn/revids.py", line 236, in get_branch_revnum
    raise e
NoSuchRevision: <bzrlib.plugins.svn.cache.tdbcache.RevisionIdMapCache object at 0xb65061ac> has no revision gkloss@it041227-20090705203722-z1cliuv0skxfqltb

bzr 1.16.1 on python 2.6.2 (linux2)
arguments: ['/usr/bin/bzr', 'merge', '-r', 'revid:gkloss@it041227-20090705203722-z1cliuv0skxfqltb']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_NZ.UTF-8'
plugins:
  bzrtools /usr/lib/python2.6/dist-packages/bzrlib/plugins/bzrtools [1.16]
  launchpad /usr/lib/python2.6/dist-packages/bzrlib/plugins/launchpad [1.16.1]
  netrc_credential_store /usr/lib/python2.6/dist-packages/bzrlib/plugins/netrc_credential_store [1.16.1]
  qbzr /usr/lib/python2.6/dist-packages/bzrlib/plugins/qbzr [0.9.8]
  svn /usr/lib/python2.6/dist-packages/bzrlib/plugins/svn [0.6.2]
  xmloutput /usr/lib/python2.6/dist-packages/bzrlib/plugins/xmloutput [0.8.3]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

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

This is a bug in the "bzr merge" UI, which should be handling NoSuchRevision. This problem also occurs against a regular bzr branch.

affects: bzr-svn → bzr
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 395906] Re: bzr merge crashes on erroneous command line args: NoSuchRevision exception

On Sun, 2009-07-05 at 22:26 +0000, Jelmer Vernooij wrote:
> This is a bug in the "bzr merge" UI, which should be handling
> NoSuchRevision. This problem also occurs against a regular bzr branch.

I'm leery of catching NSR, it indicates real problems; perhaps the
revid: revspec should do existence checking.

-Rob

Revision history for this message
Martin Pool (mbp) wrote : Re: bzr merge crashes on erroneous command line args: NoSuchRevision exception

Guy,

It's not exactly that the last argument is mandatory and we crash when it's not given. Rather, merge with no path specified means to merge from the default location, typically your parent branch. That branch doesn't contain the revision you named therefore you get this error.

In many cases it does indicate an actual internal error, but with -r revid: obviously you can provoke it at will.

Options:

 - NoSuchRevision should just give an error rather than a traceback, with the traceback being logged to ~/.bzr.log.
 - NoSuchRevision remains as it is, but it's specially treated as a user error if encountered when looking up a revision spec.
 - Possibly bzr merge should not have a default source; it's neither so obvious nor so necessary as for push and pull.

description: updated
Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
Martin Pool (mbp)
summary: - bzr merge crashes on erroneous command line args: NoSuchRevision
- exception
+ NoSuchRevision traceback when given revid is not in the default merge
+ source
Revision history for this message
Guy K. Kloss (guy.kloss) wrote :

Thanks for clarifying.

If I look at the Zen of Python:

>>> import this
The Zen of Python, by Tim Peters
[snip]
Explicit is better than implicit.

I would vote for option #3 to make it rather obvious. Otherwise: bzr is an end user tool (with the developer being an end user to the tool). So, if an error occurs, then it should (from my point of view) be handled as #1 to inform gracefully, as an exception with a stack trace indicates commonly an application error, not a configuration error of the environment the tool is used in.

Revision history for this message
Martin Pool (mbp) wrote :

Bug 397253 for removing the default.

Jelmer Vernooij (jelmer)
tags: added: merge
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.