##// END OF EJS Templates
log: fix behavior with empty repositories (issue3497)...
Alexander Plavin -
r18991:c1af1fb3 default
parent child Browse files
Show More
@@ -1022,8 +1022,6 b' def walkchangerevs(repo, match, opts, pr'
1022
1022
1023 follow = opts.get('follow') or opts.get('follow_first')
1023 follow = opts.get('follow') or opts.get('follow_first')
1024
1024
1025 if not len(repo):
1026 return []
1027 if opts.get('rev'):
1025 if opts.get('rev'):
1028 revs = scmutil.revrange(repo, opts.get('rev'))
1026 revs = scmutil.revrange(repo, opts.get('rev'))
1029 elif follow:
1027 elif follow:
@@ -771,6 +771,10 b' class revlog(object):'
771 nl = [n for n in nl if hex(n).startswith(id)]
771 nl = [n for n in nl if hex(n).startswith(id)]
772 if len(nl) > 0:
772 if len(nl) > 0:
773 if len(nl) == 1:
773 if len(nl) == 1:
774 if nl[0] == nullid:
775 # dummy null revision always exists,
776 # it shouldn't be returned here
777 return None
774 self._pcache[id] = nl[0]
778 self._pcache[id] = nl[0]
775 return nl[0]
779 return nl[0]
776 raise LookupError(id, self.indexfile,
780 raise LookupError(id, self.indexfile,
@@ -238,12 +238,10 b' def rangeset(repo, subset, x, y):'
238 return [x for x in r if x in s]
238 return [x for x in r if x in s]
239
239
240 def dagrange(repo, subset, x, y):
240 def dagrange(repo, subset, x, y):
241 if subset:
241 r = list(repo)
242 r = list(repo)
242 xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
243 xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
243 s = set(subset)
244 s = set(subset)
244 return [r for r in xs if r in s]
245 return [r for r in xs if r in s]
246 return []
247
245
248 def andset(repo, subset, x, y):
246 def andset(repo, subset, x, y):
249 return getset(repo, getset(repo, subset, x), y)
247 return getset(repo, getset(repo, subset, x), y)
@@ -267,10 +267,13 b' shell aliases with global options'
267 $ hg init sub
267 $ hg init sub
268 $ cd sub
268 $ cd sub
269 $ hg count 'branch(default)'
269 $ hg count 'branch(default)'
270 abort: unknown revision 'default'!
270 0
271 0
271 $ hg -v count 'branch(default)'
272 $ hg -v count 'branch(default)'
273 abort: unknown revision 'default'!
272 0
274 0
273 $ hg -R .. count 'branch(default)'
275 $ hg -R .. count 'branch(default)'
276 abort: unknown revision 'default'!
274 0
277 0
275 $ hg --cwd .. count 'branch(default)'
278 $ hg --cwd .. count 'branch(default)'
276 2
279 2
@@ -1542,6 +1542,7 b' have 2 filelog topological heads in a li'
1542 $ testlog --follow
1542 $ testlog --follow
1543 []
1543 []
1544 []
1544 []
1545 abort: unknown revision '0'!
1545 $ echo a > a
1546 $ echo a > a
1546 $ echo aa > aa
1547 $ echo aa > aa
1547 $ echo f > f
1548 $ echo f > f
@@ -1,3 +1,20 b''
1 Log on empty repository: checking consistency
2
3 $ hg init empty
4 $ cd empty
5 $ hg log
6 $ hg log -r 1
7 abort: unknown revision '1'!
8 [255]
9 $ hg log -r -1:0
10 abort: unknown revision '-1'!
11 [255]
12 $ hg log -r 'branch(name)'
13 abort: unknown revision 'name'!
14 [255]
15 $ hg log -r null -q
16 -1:000000000000
17
1 The g is crafted to have 2 filelog topological heads in a linear
18 The g is crafted to have 2 filelog topological heads in a linear
2 changeset graph
19 changeset graph
3
20
General Comments 0
You need to be logged in to leave comments. Login now