Show More
@@ -540,6 +540,11 b' def getparser():' | |||||
540 | action="store_true", |
|
540 | action="store_true", | |
541 | help="show chg debug logs", |
|
541 | help="show chg debug logs", | |
542 | ) |
|
542 | ) | |
|
543 | hgconf.add_argument( | |||
|
544 | "--rhg", | |||
|
545 | action="store_true", | |||
|
546 | help="install and use rhg Rust implementation in place of hg", | |||
|
547 | ) | |||
543 | hgconf.add_argument("--compiler", help="compiler to build with") |
|
548 | hgconf.add_argument("--compiler", help="compiler to build with") | |
544 | hgconf.add_argument( |
|
549 | hgconf.add_argument( | |
545 | '--extra-config-opt', |
|
550 | '--extra-config-opt', | |
@@ -552,6 +557,7 b' def getparser():' | |||||
552 | "--local", |
|
557 | "--local", | |
553 | action="store_true", |
|
558 | action="store_true", | |
554 | help="shortcut for --with-hg=<testdir>/../hg, " |
|
559 | help="shortcut for --with-hg=<testdir>/../hg, " | |
|
560 | "--with-rhg=<testdir>/../rust/target/release/rhg if --rhg is set, " | |||
555 | "and --with-chg=<testdir>/../contrib/chg/chg if --chg is set", |
|
561 | "and --with-chg=<testdir>/../contrib/chg/chg if --chg is set", | |
556 | ) |
|
562 | ) | |
557 | hgconf.add_argument( |
|
563 | hgconf.add_argument( | |
@@ -580,6 +586,11 b' def getparser():' | |||||
580 | help="use specified chg wrapper in place of hg", |
|
586 | help="use specified chg wrapper in place of hg", | |
581 | ) |
|
587 | ) | |
582 | hgconf.add_argument( |
|
588 | hgconf.add_argument( | |
|
589 | "--with-rhg", | |||
|
590 | metavar="RHG", | |||
|
591 | help="use specified rhg Rust implementation in place of hg", | |||
|
592 | ) | |||
|
593 | hgconf.add_argument( | |||
583 | "--with-hg", |
|
594 | "--with-hg", | |
584 | metavar="HG", |
|
595 | metavar="HG", | |
585 | help="test using specified hg script rather than a " |
|
596 | help="test using specified hg script rather than a " | |
@@ -667,13 +678,17 b' def parseargs(args, parser):' | |||||
667 | parser.error('--rust cannot be used with --no-rust') |
|
678 | parser.error('--rust cannot be used with --no-rust') | |
668 |
|
679 | |||
669 | if options.local: |
|
680 | if options.local: | |
670 | if options.with_hg or options.with_chg: |
|
681 | if options.with_hg or options.with_rhg or options.with_chg: | |
671 | parser.error('--local cannot be used with --with-hg or --with-chg') |
|
682 | parser.error( | |
|
683 | '--local cannot be used with --with-hg or --with-rhg or --with-chg' | |||
|
684 | ) | |||
672 | testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0]))) |
|
685 | testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0]))) | |
673 | reporootdir = os.path.dirname(testdir) |
|
686 | reporootdir = os.path.dirname(testdir) | |
674 | pathandattrs = [(b'hg', 'with_hg')] |
|
687 | pathandattrs = [(b'hg', 'with_hg')] | |
675 | if options.chg: |
|
688 | if options.chg: | |
676 | pathandattrs.append((b'contrib/chg/chg', 'with_chg')) |
|
689 | pathandattrs.append((b'contrib/chg/chg', 'with_chg')) | |
|
690 | if options.rhg: | |||
|
691 | pathandattrs.append((b'rust/target/release/rhg', 'with_rhg')) | |||
677 | for relpath, attr in pathandattrs: |
|
692 | for relpath, attr in pathandattrs: | |
678 | binpath = os.path.join(reporootdir, relpath) |
|
693 | binpath = os.path.join(reporootdir, relpath) | |
679 | if os.name != 'nt' and not os.access(binpath, os.X_OK): |
|
694 | if os.name != 'nt' and not os.access(binpath, os.X_OK): | |
@@ -696,6 +711,8 b' def parseargs(args, parser):' | |||||
696 |
|
711 | |||
697 | if (options.chg or options.with_chg) and os.name == 'nt': |
|
712 | if (options.chg or options.with_chg) and os.name == 'nt': | |
698 | parser.error('chg does not work on %s' % os.name) |
|
713 | parser.error('chg does not work on %s' % os.name) | |
|
714 | if (options.rhg or options.with_rhg) and os.name == 'nt': | |||
|
715 | parser.error('rhg does not work on %s' % os.name) | |||
699 | if options.with_chg: |
|
716 | if options.with_chg: | |
700 | options.chg = False # no installation to temporary location |
|
717 | options.chg = False # no installation to temporary location | |
701 | options.with_chg = canonpath(_sys2bytes(options.with_chg)) |
|
718 | options.with_chg = canonpath(_sys2bytes(options.with_chg)) | |
@@ -704,12 +721,28 b' def parseargs(args, parser):' | |||||
704 | and os.access(options.with_chg, os.X_OK) |
|
721 | and os.access(options.with_chg, os.X_OK) | |
705 | ): |
|
722 | ): | |
706 | parser.error('--with-chg must specify a chg executable') |
|
723 | parser.error('--with-chg must specify a chg executable') | |
|
724 | if options.with_rhg: | |||
|
725 | options.rhg = False # no installation to temporary location | |||
|
726 | options.with_rhg = canonpath(_sys2bytes(options.with_rhg)) | |||
|
727 | if not ( | |||
|
728 | os.path.isfile(options.with_rhg) | |||
|
729 | and os.access(options.with_rhg, os.X_OK) | |||
|
730 | ): | |||
|
731 | parser.error('--with-rhg must specify a rhg executable') | |||
707 | if options.chg and options.with_hg: |
|
732 | if options.chg and options.with_hg: | |
708 | # chg shares installation location with hg |
|
733 | # chg shares installation location with hg | |
709 | parser.error( |
|
734 | parser.error( | |
710 | '--chg does not work when --with-hg is specified ' |
|
735 | '--chg does not work when --with-hg is specified ' | |
711 | '(use --with-chg instead)' |
|
736 | '(use --with-chg instead)' | |
712 | ) |
|
737 | ) | |
|
738 | if options.rhg and options.with_hg: | |||
|
739 | # rhg shares installation location with hg | |||
|
740 | parser.error( | |||
|
741 | '--rhg does not work when --with-hg is specified ' | |||
|
742 | '(use --with-rhg instead)' | |||
|
743 | ) | |||
|
744 | if options.rhg and options.chg: | |||
|
745 | parser.error('--rhg and --chg do not work together') | |||
713 |
|
746 | |||
714 | if options.color == 'always' and not pygmentspresent: |
|
747 | if options.color == 'always' and not pygmentspresent: | |
715 | sys.stderr.write( |
|
748 | sys.stderr.write( | |
@@ -934,6 +967,7 b' class Test(unittest.TestCase):' | |||||
934 | slowtimeout=None, |
|
967 | slowtimeout=None, | |
935 | usechg=False, |
|
968 | usechg=False, | |
936 | chgdebug=False, |
|
969 | chgdebug=False, | |
|
970 | rhg_fallback_exe=None, | |||
937 | useipv6=False, |
|
971 | useipv6=False, | |
938 | ): |
|
972 | ): | |
939 | """Create a test from parameters. |
|
973 | """Create a test from parameters. | |
@@ -991,6 +1025,7 b' class Test(unittest.TestCase):' | |||||
991 | self._hgcommand = hgcommand or b'hg' |
|
1025 | self._hgcommand = hgcommand or b'hg' | |
992 | self._usechg = usechg |
|
1026 | self._usechg = usechg | |
993 | self._chgdebug = chgdebug |
|
1027 | self._chgdebug = chgdebug | |
|
1028 | self._rhg_fallback_exe = rhg_fallback_exe | |||
994 | self._useipv6 = useipv6 |
|
1029 | self._useipv6 = useipv6 | |
995 |
|
1030 | |||
996 | self._aborted = False |
|
1031 | self._aborted = False | |
@@ -1473,6 +1508,12 b' class Test(unittest.TestCase):' | |||||
1473 | hgrc.write(b'ipv6 = %r\n' % self._useipv6) |
|
1508 | hgrc.write(b'ipv6 = %r\n' % self._useipv6) | |
1474 | hgrc.write(b'server-header = testing stub value\n') |
|
1509 | hgrc.write(b'server-header = testing stub value\n') | |
1475 |
|
1510 | |||
|
1511 | if self._rhg_fallback_exe: | |||
|
1512 | hgrc.write(b'[rhg]\n') | |||
|
1513 | hgrc.write( | |||
|
1514 | b'fallback-executable = %s\n' % self._rhg_fallback_exe | |||
|
1515 | ) | |||
|
1516 | ||||
1476 | for opt in self._extraconfigopts: |
|
1517 | for opt in self._extraconfigopts: | |
1477 | section, key = _sys2bytes(opt).split(b'.', 1) |
|
1518 | section, key = _sys2bytes(opt).split(b'.', 1) | |
1478 | assert b'=' in key, ( |
|
1519 | assert b'=' in key, ( | |
@@ -2958,6 +2999,7 b' class TestRunner(object):' | |||||
2958 | self._coveragefile = None |
|
2999 | self._coveragefile = None | |
2959 | self._createdfiles = [] |
|
3000 | self._createdfiles = [] | |
2960 | self._hgcommand = None |
|
3001 | self._hgcommand = None | |
|
3002 | self._rhg_fallback_exe = None | |||
2961 | self._hgpath = None |
|
3003 | self._hgpath = None | |
2962 | self._portoffset = 0 |
|
3004 | self._portoffset = 0 | |
2963 | self._ports = {} |
|
3005 | self._ports = {} | |
@@ -3098,6 +3140,16 b' class TestRunner(object):' | |||||
3098 | chgbindir = os.path.dirname(os.path.realpath(self.options.with_chg)) |
|
3140 | chgbindir = os.path.dirname(os.path.realpath(self.options.with_chg)) | |
3099 | self._hgcommand = os.path.basename(self.options.with_chg) |
|
3141 | self._hgcommand = os.path.basename(self.options.with_chg) | |
3100 |
|
3142 | |||
|
3143 | # set fallback executable path, then replace "hg" command by "rhg" | |||
|
3144 | rhgbindir = self._bindir | |||
|
3145 | if self.options.rhg or self.options.with_rhg: | |||
|
3146 | self._rhg_fallback_exe = os.path.join(self._bindir, self._hgcommand) | |||
|
3147 | if self.options.rhg: | |||
|
3148 | self._hgcommand = b'rhg' | |||
|
3149 | elif self.options.with_rhg: | |||
|
3150 | rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg)) | |||
|
3151 | self._hgcommand = os.path.basename(self.options.with_rhg) | |||
|
3152 | ||||
3101 | osenvironb[b"BINDIR"] = self._bindir |
|
3153 | osenvironb[b"BINDIR"] = self._bindir | |
3102 | osenvironb[b"PYTHON"] = PYTHON |
|
3154 | osenvironb[b"PYTHON"] = PYTHON | |
3103 |
|
3155 | |||
@@ -3116,6 +3168,8 b' class TestRunner(object):' | |||||
3116 | path.insert(2, realdir) |
|
3168 | path.insert(2, realdir) | |
3117 | if chgbindir != self._bindir: |
|
3169 | if chgbindir != self._bindir: | |
3118 | path.insert(1, chgbindir) |
|
3170 | path.insert(1, chgbindir) | |
|
3171 | if rhgbindir != self._bindir: | |||
|
3172 | path.insert(1, rhgbindir) | |||
3119 | if self._testdir != runtestdir: |
|
3173 | if self._testdir != runtestdir: | |
3120 | path = [self._testdir] + path |
|
3174 | path = [self._testdir] + path | |
3121 | if self._tmpbindir != self._bindir: |
|
3175 | if self._tmpbindir != self._bindir: | |
@@ -3423,6 +3477,7 b' class TestRunner(object):' | |||||
3423 | hgcommand=self._hgcommand, |
|
3477 | hgcommand=self._hgcommand, | |
3424 | usechg=bool(self.options.with_chg or self.options.chg), |
|
3478 | usechg=bool(self.options.with_chg or self.options.chg), | |
3425 | chgdebug=self.options.chg_debug, |
|
3479 | chgdebug=self.options.chg_debug, | |
|
3480 | rhg_fallback_exe=self._rhg_fallback_exe, | |||
3426 | useipv6=useipv6, |
|
3481 | useipv6=useipv6, | |
3427 | **kwds |
|
3482 | **kwds | |
3428 | ) |
|
3483 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now