##// 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 parseddate = "%d %d" % util.parsedate(date)
218 parseddate = "%d %d" % util.parsedate(date)
219 else:
219 else:
220 parseddate = "%d %d" % util.makedate()
220 parseddate = "%d %d" % util.makedate()
221 if extra and extra.get("branch") in ("default", ""):
221 if extra:
222 del extra["branch"]
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 if extra:
228 if extra:
224 extra = encodeextra(extra)
229 extra = encodeextra(extra)
225 parseddate = "%s %s" % (parseddate, extra)
230 parseddate = "%s %s" % (parseddate, extra)
@@ -202,6 +202,8 b' class dirstate(object):'
202 self._pl = p1, p2
202 self._pl = p1, p2
203
203
204 def setbranch(self, branch):
204 def setbranch(self, branch):
205 if branch in ['tip', '.', 'null']:
206 raise util.Abort(_('the name \'%s\' is reserved') % branch)
205 self._branch = branch
207 self._branch = branch
206 self._opener("branch", "w").write(branch + '\n')
208 self._opener("branch", "w").write(branch + '\n')
207
209
@@ -36,6 +36,10 b' hg add c'
36 hg branch c
36 hg branch c
37 hg commit -d '5 0' -m "Adding c branch"
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 echo 'd' >d
43 echo 'd' >d
40 hg add d
44 hg add d
41 hg branch 'a branch name much longer than the default justification used by branches'
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 created new head
6 created new head
7 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
7 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
8 marked working directory as branch c
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 marked working directory as branch a branch name much longer than the default justification used by branches
12 marked working directory as branch a branch name much longer than the default justification used by branches
10 a branch name much longer than the default justification used by branches 7:10ff5895aa57
13 a branch name much longer than the default justification used by branches 7:10ff5895aa57
11 b 4:aee39cd168d0
14 b 4:aee39cd168d0
General Comments 0
You need to be logged in to leave comments. Login now