comparison mercurial/dirstate.py @ 17821:361ab1e2086f

scmutil: add bad character checking to checknewlabel This factors out the checks from tags and bookmarks, and newly applies the same prohibitions to branches. checknewlabel takes a new parameter, kind, indicating the kind of label being checked. Test coverage is added for all three types of labels.
author Kevin Bullock <kbullock@ringworld.org>
date Wed, 17 Oct 2012 21:42:06 -0500
parents ec892050f3c7
children 7b0b1da49f15
comparison
equal deleted inserted replaced
17820:c547e1acc37c 17821:361ab1e2086f
259 self.normallookup(f) 259 self.normallookup(f)
260 return copies 260 return copies
261 261
262 def setbranch(self, branch): 262 def setbranch(self, branch):
263 # no repo object here, just check for reserved names 263 # no repo object here, just check for reserved names
264 scmutil.checknewlabel(None, branch) 264 scmutil.checknewlabel(None, branch, 'branch')
265 self._branch = encoding.fromlocal(branch) 265 self._branch = encoding.fromlocal(branch)
266 f = self._opener('branch', 'w', atomictemp=True) 266 f = self._opener('branch', 'w', atomictemp=True)
267 try: 267 try:
268 f.write(self._branch + '\n') 268 f.write(self._branch + '\n')
269 finally: 269 finally: