##// END OF EJS Templates
revlog: detect pseudo file nodeids to raise WdirUnsupported exception...
Yuya Nishihara -
r37467:a0d71618 default
parent child Browse files
Show More
@@ -29,6 +29,7 b' from .node import ('
29 hex,
29 hex,
30 nullid,
30 nullid,
31 nullrev,
31 nullrev,
32 wdirfilenodeids,
32 wdirhex,
33 wdirhex,
33 wdirid,
34 wdirid,
34 wdirrev,
35 wdirrev,
@@ -807,7 +808,7 b' class revlog(object):'
807 raise
808 raise
808 except RevlogError:
809 except RevlogError:
809 # parsers.c radix tree lookup failed
810 # parsers.c radix tree lookup failed
810 if node == wdirid:
811 if node == wdirid or node in wdirfilenodeids:
811 raise error.WdirUnsupported
812 raise error.WdirUnsupported
812 raise LookupError(node, self.indexfile, _('no node'))
813 raise LookupError(node, self.indexfile, _('no node'))
813 except KeyError:
814 except KeyError:
@@ -823,7 +824,7 b' class revlog(object):'
823 if v == node:
824 if v == node:
824 self._nodepos = r - 1
825 self._nodepos = r - 1
825 return r
826 return r
826 if node == wdirid:
827 if node == wdirid or node in wdirfilenodeids:
827 raise error.WdirUnsupported
828 raise error.WdirUnsupported
828 raise LookupError(node, self.indexfile, _('no node'))
829 raise LookupError(node, self.indexfile, _('no node'))
829
830
@@ -1436,6 +1437,7 b' class revlog(object):'
1436 pass
1437 pass
1437
1438
1438 def _partialmatch(self, id):
1439 def _partialmatch(self, id):
1440 # we don't care wdirfilenodeids as they should be always full hash
1439 maybewdir = wdirhex.startswith(id)
1441 maybewdir = wdirhex.startswith(id)
1440 try:
1442 try:
1441 partial = self.index.partialmatch(id)
1443 partial = self.index.partialmatch(id)
@@ -2114,7 +2116,7 b' class revlog(object):'
2114 if node == nullid:
2116 if node == nullid:
2115 raise RevlogError(_("%s: attempt to add null revision") %
2117 raise RevlogError(_("%s: attempt to add null revision") %
2116 (self.indexfile))
2118 (self.indexfile))
2117 if node == wdirid:
2119 if node == wdirid or node in wdirfilenodeids:
2118 raise RevlogError(_("%s: attempt to add wdir revision") %
2120 raise RevlogError(_("%s: attempt to add wdir revision") %
2119 (self.indexfile))
2121 (self.indexfile))
2120
2122
@@ -245,7 +245,7 b' Test wdir'
245 $ hg stat
245 $ hg stat
246 M port2
246 M port2
247 $ hg grep -r 'wdir()' port
247 $ hg grep -r 'wdir()' port
248 abort: data/port2.i@303030303030: no node!
248 abort: working directory revision cannot be specified
249 [255]
249 [255]
250
250
251 $ cd ..
251 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now