##// END OF EJS Templates
commands: add more robust support for 'hg log -b' (issue2078)...
Steve Losh -
r10960:ca739acf default
parent child Browse files
Show More
@@ -2160,6 +2160,7 b' def log(ui, repo, *pats, **opts):'
2160 df = util.matchdate(opts["date"])
2160 df = util.matchdate(opts["date"])
2161
2161
2162 opts['branch'] += opts.get('only_branch')
2162 opts['branch'] += opts.get('only_branch')
2163 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2163
2164
2164 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
2165 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
2165 def prep(ctx, fns):
2166 def prep(ctx, fns):
@@ -455,6 +455,14 b' class localrepository(repo.repository):'
455 pass
455 pass
456 raise error.RepoLookupError(_("unknown revision '%s'") % key)
456 raise error.RepoLookupError(_("unknown revision '%s'") % key)
457
457
458 def lookupbranch(self, key, remote=None):
459 repo = remote or self
460 if key in repo.branchmap():
461 return key
462
463 repo = (remote and remote.local()) and remote or self
464 return repo[key].branch()
465
458 def local(self):
466 def local(self):
459 return True
467 return True
460
468
@@ -162,7 +162,19 b' hg log -b test'
162 echo '% log -b dummy'
162 echo '% log -b dummy'
163 hg log -b dummy
163 hg log -b dummy
164
164
165 echo '% log -b .'
166 hg log -b .
167
165 echo '% log -b default -b test'
168 echo '% log -b default -b test'
166 hg log -b default -b test
169 hg log -b default -b test
167
170
171 echo '% log -b default -b .'
172 hg log -b default -b .
173
174 echo '% log -b . -b test'
175 hg log -b . -b test
176
177 echo '% log -b 2'
178 hg log -b 2
179
168 exit 0
180 exit 0
@@ -360,6 +360,22 b' date: Thu Jan 01 00:00:00 1970 +0'
360 summary: commit on test
360 summary: commit on test
361
361
362 % log -b dummy
362 % log -b dummy
363 abort: unknown revision 'dummy'!
364 % log -b .
365 changeset: 3:f5d8de11c2e2
366 branch: test
367 tag: tip
368 parent: 1:d32277701ccb
369 user: test
370 date: Thu Jan 01 00:00:00 1970 +0000
371 summary: commit on test
372
373 changeset: 1:d32277701ccb
374 branch: test
375 user: test
376 date: Thu Jan 01 00:00:00 1970 +0000
377 summary: commit on test
378
363 % log -b default -b test
379 % log -b default -b test
364 changeset: 3:f5d8de11c2e2
380 changeset: 3:f5d8de11c2e2
365 branch: test
381 branch: test
@@ -386,3 +402,56 b' user: test'
386 date: Thu Jan 01 00:00:00 1970 +0000
402 date: Thu Jan 01 00:00:00 1970 +0000
387 summary: commit on default
403 summary: commit on default
388
404
405 % log -b default -b .
406 changeset: 3:f5d8de11c2e2
407 branch: test
408 tag: tip
409 parent: 1:d32277701ccb
410 user: test
411 date: Thu Jan 01 00:00:00 1970 +0000
412 summary: commit on test
413
414 changeset: 2:c3a4f03cc9a7
415 parent: 0:24427303d56f
416 user: test
417 date: Thu Jan 01 00:00:00 1970 +0000
418 summary: commit on default
419
420 changeset: 1:d32277701ccb
421 branch: test
422 user: test
423 date: Thu Jan 01 00:00:00 1970 +0000
424 summary: commit on test
425
426 changeset: 0:24427303d56f
427 user: test
428 date: Thu Jan 01 00:00:00 1970 +0000
429 summary: commit on default
430
431 % log -b . -b test
432 changeset: 3:f5d8de11c2e2
433 branch: test
434 tag: tip
435 parent: 1:d32277701ccb
436 user: test
437 date: Thu Jan 01 00:00:00 1970 +0000
438 summary: commit on test
439
440 changeset: 1:d32277701ccb
441 branch: test
442 user: test
443 date: Thu Jan 01 00:00:00 1970 +0000
444 summary: commit on test
445
446 % log -b 2
447 changeset: 2:c3a4f03cc9a7
448 parent: 0:24427303d56f
449 user: test
450 date: Thu Jan 01 00:00:00 1970 +0000
451 summary: commit on default
452
453 changeset: 0:24427303d56f
454 user: test
455 date: Thu Jan 01 00:00:00 1970 +0000
456 summary: commit on default
457
General Comments 0
You need to be logged in to leave comments. Login now