Skip to content

Commit b4755d7

Browse files
committed
remove sh/pbs dependency
sh doesn't work on Windows and pbs is no longer supported and doesn't work on Python 3
1 parent 516d961 commit b4755d7

File tree

8 files changed

+379
-371
lines changed

8 files changed

+379
-371
lines changed

gitless/cli/gl.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
import traceback
1414
import pygit2
1515

16-
if sys.platform != 'win32':
17-
from sh import ErrorReturnCode
18-
else:
19-
from pbs import ErrorReturnCode
16+
from subprocess import CalledProcessError
2017

2118
from gitless import core
2219

@@ -124,7 +121,7 @@ def main():
124121
except (ValueError, pygit2.GitError, core.GlError) as e:
125122
pprint.err(e)
126123
return ERRORS_FOUND
127-
except ErrorReturnCode as e:
124+
except CalledProcessError as e:
128125
pprint.err(e.stderr)
129126
return ERRORS_FOUND
130127
except:

gitless/cli/gl_commit.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77

88
from __future__ import unicode_literals
99

10-
import subprocess
11-
12-
import sys
13-
if sys.platform != 'win32':
14-
from sh import git
15-
else:
16-
from pbs import Command
17-
git = Command('git')
18-
1910
from gitless import core
2011

2112
from . import commit_dialog
@@ -74,7 +65,7 @@ def main(args, repo):
7465
msg = args.m if args.m else commit_dialog.show(commit_files, repo)
7566
if not msg.strip():
7667
if partials:
77-
git.reset('HEAD', partials)
68+
core.git('reset', 'HEAD', partials)
7869
raise ValueError('Missing commit message')
7970

8071
_auto_track(commit_files, curr_b)
@@ -121,7 +112,7 @@ def _do_partial_selection(files, curr_b):
121112
pprint.warn('Can\'t select segments for deleted file {0}'.format(fp))
122113
continue
123114

124-
subprocess.call(['git', 'add', '-p', fp])
115+
core.git('add', '-p', fp)
125116
# TODO: check that at least one hunk was staged
126117
partials.append(fp)
127118

0 commit comments

Comments
 (0)