Esempio n. 1
0
    def run_command(self, cmd):
        args = list(parsing.CommandLexer(cmd))
        if args[0] == 'hg':
            logging.debug("Stripped superfluous 'hg' from command.")
            args = args[1:]

        logging.debug("Sending command '%s' as %s" % (args, args))
        self.server.stdin.write('runcommand\n'.encode('ascii'))
        self._write_block(args)
Esempio n. 2
0
 def testCanLexLongStringWithEmbeddedEscapedQuotes(self):
     l = parsing.CommandLexer('commit -m "foo \\"bar\\" foo"')
     self.assertEqual(list(l), ['commit', '-m', 'foo "bar" foo'])
     l = parsing.CommandLexer('commit -m "foo \\"bar fuzz\\" foo"')
     self.assertEqual(list(l), ['commit', '-m', 'foo "bar fuzz" foo'])
Esempio n. 3
0
 def testCanLexLongStringArg(self):
     l = parsing.CommandLexer('commit -m "foo bar foo"')
     self.assertEqual(list(l), ['commit', '-m', 'foo bar foo'])
Esempio n. 4
0
 def testCanLexMultipleMixedOptions(self):
     l = parsing.CommandLexer('log -r10 -G')
     self.assertEqual(list(l), ['log', '-r', '10', '-G'])
Esempio n. 5
0
 def testCanLexOptionWithArg(self):
     l = parsing.CommandLexer('diff -r 100')
     self.assertEqual(list(l), ['diff', '-r', '100'])
     l = parsing.CommandLexer('diff -r100')
     self.assertEqual(list(l), ['diff', '-r', '100'])
Esempio n. 6
0
 def testCanLexLongSimpleOption(self):
     l = parsing.CommandLexer('status --no-status')
     self.assertEqual(list(l), ['status', '--no-status'])
Esempio n. 7
0
 def testCanLexMultipleShortSimpleOption(self):
     l = parsing.CommandLexer('status -n -x')
     self.assertEqual(list(l), ['status', '-n', '-x'])
     l = parsing.CommandLexer('status -n -G')
     self.assertEqual(list(l), ['status', '-n', '-G'])
Esempio n. 8
0
 def testCanLexShortSimpleOption(self):
     l = parsing.CommandLexer('status -n')
     self.assertEqual(list(l), ['status', '-n'])
Esempio n. 9
0
 def testCanLexSimple(self):
     l = parsing.CommandLexer('status')
     self.assertEqual(list(l), ['status'])