##// END OF EJS Templates
branch: avoid using reserved tag names...
Wagner Bruna -
r10417:58e040c5 stable
parent child Browse files
Show More
@@ -218,8 +218,13 b' class changelog(revlog.revlog):'
218 218 parseddate = "%d %d" % util.parsedate(date)
219 219 else:
220 220 parseddate = "%d %d" % util.makedate()
221 if extra and extra.get("branch") in ("default", ""):
222 del extra["branch"]
221 if extra:
222 branch = extra.get("branch")
223 if branch in ("default", ""):
224 del extra["branch"]
225 elif branch in (".", "null", "tip"):
226 raise error.RevlogError(_('the name \'%s\' is reserved')
227 % branch)
223 228 if extra:
224 229 extra = encodeextra(extra)
225 230 parseddate = "%s %s" % (parseddate, extra)
@@ -202,6 +202,8 b' class dirstate(object):'
202 202 self._pl = p1, p2
203 203
204 204 def setbranch(self, branch):
205 if branch in ['tip', '.', 'null']:
206 raise util.Abort(_('the name \'%s\' is reserved') % branch)
205 207 self._branch = branch
206 208 self._opener("branch", "w").write(branch + '\n')
207 209
@@ -36,6 +36,10 b' hg add c'
36 36 hg branch c
37 37 hg commit -d '5 0' -m "Adding c branch"
38 38
39 hg branch tip
40 hg branch null
41 hg branch .
42
39 43 echo 'd' >d
40 44 hg add d
41 45 hg branch 'a branch name much longer than the default justification used by branches'
@@ -6,6 +6,9 b' marked working directory as branch b'
6 6 created new head
7 7 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
8 8 marked working directory as branch c
9 abort: the name 'tip' is reserved
10 abort: the name 'null' is reserved
11 abort: the name '.' is reserved
9 12 marked working directory as branch a branch name much longer than the default justification used by branches
10 13 a branch name much longer than the default justification used by branches 7:10ff5895aa57
11 14 b 4:aee39cd168d0
General Comments 0
You need to be logged in to leave comments. Login now