~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/msgeditor.py

- fix up imports in remotebranch

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