Review Board

beta

Fix actions when the menu is invoked outside a repository.

Updated 7 months, 1 week ago

Germán Póo-Caamaño Reviewers
tortoise-hg
None tortoisehg-dev
nautilus: fix menu for non-repo dirs
Before applying this patch, the .xsession-errors has the following output:

Traceback (most recent call last):
  File "/home/gpoo/.nautilus/python-extensions/nautilus-thg.py", line 96, in _clone_cb
    self._run_dialog('clone', [vfs_file])
  File "/home/gpoo/.nautilus/python-extensions/nautilus-thg.py", line 172, in _run_dialog
    cmdopts += ['--root', repo.root]
AttributeError: 'NoneType' object has no attribute 'root'
Traceback (most recent call last):
  File "/home/gpoo/.nautilus/python-extensions/nautilus-thg.py", line 126, in _init_cb
    self._run_dialog('init', [vfs_file])
  File "/home/gpoo/.nautilus/python-extensions/nautilus-thg.py", line 172, in _run_dialog
    cmdopts += ['--root', repo.root]
AttributeError: 'NoneType' object has no attribute 'root'

This happens because in fact there is no repo at all.  Easy to test.  Just call the menu 
inside and outside a repo.
Posted 7 months, 1 week ago (May 28th, 2008, 1:54 a.m.)
OK, I've tried this reviewboard thing. But I'm not sure I'm liking it, especially for such small patches. With with mor contentious changes where numerous people comment it might pay off.

If we continue using this, I suggest we establish a convention that the "Description" field is going to be the changelog entry. Your current description has no proper tag line (for example: nautilus: fix menu for non-repo dirs\n\n...).
  1. Germán Póo-Caamaño 7 months, 1 week ago (May 29th, 2008, 10:02 a.m.)
    I didn't realized about the changelog's format.  Thanks for pointing out.
    
    However, I don't get the '\n\n' thing.  Do you mean in the specific case of description/review-board?  In mercurial I usually commit through 'hg commit -m "..."', not calling the editor.
Loading diff fragment...
How about `root = repo and repo.root or cwd` to continue the style of the above line initializing cwd? I don't really expect repo.root to ever be empty (should always be at least /).
  1. Germán Póo-Caamaño 7 months, 1 week ago (May 29th, 2008, 9:58 a.m.)
    Well, it happens because the method get_repo_for_path returns None if the exception repo.RepoError is triggered.
    
    But, certainly I agree the one-line style is much better.