Show More
@@ -470,13 +470,26 b' def revpair(repo, revs):' | |||||
470 |
|
470 | |||
471 | l = revrange(repo, revs) |
|
471 | l = revrange(repo, revs) | |
472 |
|
472 | |||
473 | if len(l) == 0: |
|
473 | if not l: | |
|
474 | first = second = None | |||
|
475 | elif l.isascending(): | |||
|
476 | first = l.min() | |||
|
477 | second = l.max() | |||
|
478 | elif l.isdescending(): | |||
|
479 | first = l.max() | |||
|
480 | second = l.min() | |||
|
481 | else: | |||
|
482 | l = list(l) | |||
|
483 | first = l[0] | |||
|
484 | second = l[-1] | |||
|
485 | ||||
|
486 | if first is None: | |||
474 | raise util.Abort(_('empty revision range')) |
|
487 | raise util.Abort(_('empty revision range')) | |
475 |
|
488 | |||
476 |
if |
|
489 | if first == second and len(revs) == 1 and _revrangesep not in revs[0]: | |
477 |
return repo.lookup( |
|
490 | return repo.lookup(first), None | |
478 |
|
491 | |||
479 |
return repo.lookup( |
|
492 | return repo.lookup(first), repo.lookup(second) | |
480 |
|
493 | |||
481 | _revrangesep = ':' |
|
494 | _revrangesep = ':' | |
482 |
|
495 |
@@ -744,6 +744,43 b' multiple revspecs' | |||||
744 | 6 |
|
744 | 6 | |
745 | 7 |
|
745 | 7 | |
746 |
|
746 | |||
|
747 | test usage in revpair (with "+") | |||
|
748 | ||||
|
749 | (real pair) | |||
|
750 | ||||
|
751 | $ hg diff -r 'tip^^' -r 'tip' | |||
|
752 | diff -r 2326846efdab -r 24286f4ae135 .hgtags | |||
|
753 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
754 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 | |||
|
755 | @@ -0,0 +1,1 @@ | |||
|
756 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 | |||
|
757 | $ hg diff -r 'tip^^::tip' | |||
|
758 | diff -r 2326846efdab -r 24286f4ae135 .hgtags | |||
|
759 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
760 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 | |||
|
761 | @@ -0,0 +1,1 @@ | |||
|
762 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 | |||
|
763 | ||||
|
764 | (single rev) | |||
|
765 | ||||
|
766 | $ hg diff -r 'tip^' -r 'tip^' | |||
|
767 | $ hg diff -r 'tip^::tip^ or tip^' | |||
|
768 | ||||
|
769 | (single rev that does not looks like a range) | |||
|
770 | ||||
|
771 | $ hg diff -r 'tip^ or tip^' | |||
|
772 | diff -r d5d0dcbdc4d9 .hgtags | |||
|
773 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
774 | +++ b/.hgtags * (glob) | |||
|
775 | @@ -0,0 +1,1 @@ | |||
|
776 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 | |||
|
777 | ||||
|
778 | (no rev) | |||
|
779 | ||||
|
780 | $ hg diff -r 'author("babar") or author("celeste")' | |||
|
781 | abort: empty revision range | |||
|
782 | [255] | |||
|
783 | ||||
747 | aliases: |
|
784 | aliases: | |
748 |
|
785 | |||
749 | $ echo '[revsetalias]' >> .hg/hgrc |
|
786 | $ echo '[revsetalias]' >> .hg/hgrc |
General Comments 0
You need to be logged in to leave comments.
Login now