# HG changeset patch # User mpm@selenic.com # Date 1127523003 25200 # Node ID d4b25df77a9e9fd6d3a2861d48263b53f76e60c4 # Parent 8c094fb47b59234088c549a9bcf8deb9316c0d7b Fix up some bugs for log and grep with empty repo diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -74,6 +74,10 @@ def walkchangerevs(ui, repo, cwd, pats, "iter", rev, None: in-order traversal of the revs earlier iterated over with "add" - use to display data''' + + if repo.changelog.count() == 0: + return [], False + cwd = repo.getcwd() if not pats and cwd: opts['include'] = [os.path.join(cwd, i) for i in opts['include']] @@ -1055,6 +1059,7 @@ def grep(ui, repo, pattern, *pats, **opt skip = {} changeiter, getchange = walkchangerevs(ui, repo, repo.getcwd(), pats, opts) count = 0 + incrementing = False for st, rev, fns in changeiter: if st == 'window': incrementing = rev