[PATCH] scmutil: generalize message to make it more i18n-friendly
Wagner Bruna
wagner.bruna+mercurial at gmail.com
Sun Oct 21 13:37:46 UTC 2012
# HG changeset patch
# User Wagner Bruna <wbruna at yahoo.com>
# Date 1350825633 7200
# Branch stable
# Node ID ed397d5fa57a406603147a1a87b161ca24c1e5c2
# Parent b32e55e6c3c729c1eb0658a0c3bc109259bfdae6
scmutil: generalize message to make it more i18n-friendly
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -794,7 +794,7 @@
if not mark:
raise util.Abort(_("bookmark names cannot consist entirely of "
"whitespace"))
- scmutil.checknewlabel(repo, mark, 'bookmark')
+ scmutil.checknewlabel(repo, mark)
return mark
def checkconflict(repo, mark, force=False):
@@ -5666,7 +5666,7 @@
if len(names) != len(set(names)):
raise util.Abort(_('tag names must be unique'))
for n in names:
- scmutil.checknewlabel(repo, n, 'tag')
+ scmutil.checknewlabel(repo, n)
if not n:
raise util.Abort(_('tag names cannot consist entirely of '
'whitespace'))
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -261,7 +261,7 @@
def setbranch(self, branch):
# no repo object here, just check for reserved names
- scmutil.checknewlabel(None, branch, 'branch')
+ scmutil.checknewlabel(None, branch)
self._branch = encoding.fromlocal(branch)
f = self._opener('branch', 'w', atomictemp=True)
try:
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -27,13 +27,13 @@
else:
ui.status(_("no changes found\n"))
-def checknewlabel(repo, lbl, kind):
+def checknewlabel(repo, lbl):
if lbl in ['tip', '.', 'null']:
raise util.Abort(_("the name '%s' is reserved") % lbl)
for c in (':', '\0', '\n', '\r'):
if c in lbl:
- raise util.Abort(_("%r cannot be used in a %s name") %
- (c, kind))
+ raise util.Abort(_("%r cannot be used in a tag, branch "
+ "or bookmark name") % c)
def checkfilename(f):
'''Check that the filename f is an acceptable filename for a tracked file'''
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -302,12 +302,12 @@
invalid bookmark
$ hg bookmark 'foo:bar'
- abort: ':' cannot be used in a bookmark name
+ abort: ':' cannot be used in a tag, branch or bookmark name
[255]
$ hg bookmark 'foo
> bar'
- abort: '\n' cannot be used in a bookmark name
+ abort: '\n' cannot be used in a tag, branch or bookmark name
[255]
the bookmark extension should be ignored now that it is part of core
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -60,12 +60,12 @@
invalid characters
$ hg branch 'foo:bar'
- abort: ':' cannot be used in a branch name
+ abort: ':' cannot be used in a tag, branch or bookmark name
[255]
$ hg branch 'foo
> bar'
- abort: '\n' cannot be used in a branch name
+ abort: '\n' cannot be used in a tag, branch or bookmark name
[255]
$ echo 'd' >d
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -116,10 +116,10 @@
$ hg tag -l 'xx
> newline'
- abort: '\n' cannot be used in a tag name
+ abort: '\n' cannot be used in a tag, branch or bookmark name
[255]
$ hg tag -l 'xx:xx'
- abort: ':' cannot be used in a tag name
+ abort: ':' cannot be used in a tag, branch or bookmark name
[255]
cloning local tags
More information about the Mercurial-devel
mailing list