- conflicts_file = os.path.join(basedir.get(), 'conflicts')
- if os.path.isfile(conflicts_file):
- f = file(conflicts_file)
- names = [line.strip() for line in f.readlines()]
- f.close()
- return names
- else:
- return None
-
-def _input(cmd, file_desc):
- p = popen2.Popen3(cmd, True)
- while True:
- line = file_desc.readline()
- if not line:
- break
- p.tochild.write(line)
- p.tochild.close()
- if p.wait():
- raise GitException, '%s failed (%s)' % (' '.join(cmd),
- p.childerr.read().strip())
-
-def _input_str(cmd, string):
- p = popen2.Popen3(cmd, True)
- p.tochild.write(string)
- p.tochild.close()
- if p.wait():
- raise GitException, '%s failed (%s)' % (' '.join(cmd),
- p.childerr.read().strip())
-
-def _output(cmd):
- p=popen2.Popen3(cmd, True)
- output = p.fromchild.read()
- if p.wait():
- raise GitException, '%s failed (%s)' % (' '.join(cmd),
- p.childerr.read().strip())
- return output
-
-def _output_one_line(cmd, file_desc = None):
- p=popen2.Popen3(cmd, True)
- if file_desc != None:
- for line in file_desc:
- p.tochild.write(line)
- p.tochild.close()
- output = p.fromchild.readline().strip()
- if p.wait():
- raise GitException, '%s failed (%s)' % (' '.join(cmd),
- p.childerr.read().strip())
- return output
-
-def _output_lines(cmd):
- p=popen2.Popen3(cmd, True)
- lines = p.fromchild.readlines()
- if p.wait():
- raise GitException, '%s failed (%s)' % (' '.join(cmd),
- p.childerr.read().strip())
- return lines
-
-def __run(cmd, args=None):
- """__run: runs cmd using spawnvp.
-
- Runs cmd using spawnvp. The shell is avoided so it won't mess up
- our arguments. If args is very large, the command is run multiple
- times; args is split xargs style: cmd is passed on each
- invocation. Unlike xargs, returns immediately if any non-zero
- return code is received.
- """
-
- args_l=cmd.split()
- if args is None:
- args = []
- for i in range(0, len(args)+1, 100):
- r=os.spawnvp(os.P_WAIT, args_l[0], args_l + args[i:min(i+100, len(args))])
- if r:
- return r
- return 0