~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/msgeditor.py

  • Committer: Aaron Bentley
  • Date: 2005-09-12 02:53:07 UTC
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: aaron.bentley@utoronto.ca-20050912025307-8c21544e8db1cbdb
added all_descendants and node_distances, exception when root doesn't exist

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
"""Commit message editor support."""
21
21
 
22
22
import os
23
 
from subprocess import call
24
23
from bzrlib.errors import BzrError
25
24
 
26
25
def _get_editor():
31
30
    if e is not None:
32
31
        yield e
33
32
        
34
 
    try:
35
 
        yield os.environ["EDITOR"]
36
 
    except KeyError:
37
 
        if os.name == "nt":
38
 
            yield "notepad.exe"
39
 
        elif os.name == "posix":
 
33
    if os.name == "windows":
 
34
        yield "notepad.exe"
 
35
    elif os.name == "posix":
 
36
        try:
 
37
            yield os.environ["EDITOR"]
 
38
        except KeyError:
40
39
            yield "/usr/bin/vi"
41
40
 
42
41
 
44
43
    """Try to execute an editor to edit the commit message."""
45
44
    for e in _get_editor():
46
45
        edargs = e.split(' ')
47
 
        x = call(edargs + [filename])
 
46
        x = os.spawnvp(os.P_WAIT, edargs[0],
 
47
                       edargs + [filename])
48
48
        if x == 0:
49
49
            return True
50
50
        elif x == 127: