--- a/__init__.py
+++ b/__init__.py
@@ -423,17 +423,18 @@ def infer_arguments(ui, repo, args, opts
else:
# Just right.
rev, bug = args
if rev is None:
# Default to '.'
rev = '.'
- if repo[rev] == repo["."]:
+ # If no revision or '.' was given, complain about local changes
+ if rev == '.' and not opts['force']:
m, a, r, d = repo.status()[:4]
if (m or a or r or d):
raise util.Abort(_("Local changes found; refresh first!"))
if rev in [".", "tip", "qtip", "default"]:
# Look for a nicer name in the MQ.
if hasattr(repo, 'mq') and repo.mq.applied:
rev = repo.mq.applied[-1].name
@@ -1154,23 +1155,27 @@ cmdtable = {
'Update patch name and description to include bug number (only valid with --new)'),
('', 'no-update', None,
'Suppress patch name/description update (override config file)'),
('', 'number', '',
'When posting, prefix the patch description with "Patch <number> - "'),
# The following option is passed through directly to patch.diffopts
('w', 'ignore_all_space', False,
'Generate a diff that ignores whitespace changes'),
+ ('f', 'force', False,
+ 'Proceed even if the working directory contains changes'),
] + newbug_opts,
_('hg bzexport [options] [REV] [BUG]')),
'newbug':
(newbug,
[('c', 'comment', '', 'Comment to add with the bug'),
('e', 'edit', False,
'Open a text editor to modify bug fields'),
('i', 'interactive', False,
'Interactive -- request confirmation before any permanent action'),
+ ('f', 'force', False,
+ 'Proceed even if the working directory contains changes'),
('', 'take-bug', False,
'Assign bug to myself'),
] + newbug_opts,
_('hg newbug [-e] [[-t] TITLE] [[-c] COMMENT]' )),
}