Skip to content

Commit 766b664

Browse files
committed
feat: fixed the issues after rebase
1 parent 4b98cd7 commit 766b664

File tree

4 files changed

+22
-46
lines changed

4 files changed

+22
-46
lines changed

jupyterlab_git/git.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ def communicate(self):
3737
p.expect('Password for .*:')
3838
p.sendline(self.password)
3939

40+
p.expect(pexpect.EOF)
41+
response = p.before
42+
43+
self.returncode = p.wait()
44+
p.close()
45+
46+
return response
47+
except pexpect.exceptions.EOF: #In case of pexpect failure
48+
response = p.before
49+
self.returncode = p.exitstatus
50+
p.close() #close process
51+
return response
52+
4053

4154
class Git:
4255
"""
@@ -160,7 +173,7 @@ def clone(self, current_path, repo_url, auth=None):
160173
else:
161174
env["GIT_TERMINAL_PROMPT"] = "0"
162175
p = subprocess.Popen(
163-
['git clone {}'.format(unquote(repo_url))],
176+
['git', 'clone', unquote(repo_url)],
164177
stdout=PIPE,
165178
stderr=PIPE,
166179
env = env,
@@ -616,7 +629,7 @@ def pull(self, curr_fb_path, auth=None):
616629
if (auth):
617630
env["GIT_TERMINAL_PROMPT"] = "1"
618631
p = git_auth_input_wrapper(
619-
command = ['git', 'pull', '--no-commit'],
632+
command = 'git pull --no-commit',
620633
cwd = os.path.join(self.root_dir, curr_fb_path),
621634
env = env,
622635
username = auth['username'],
@@ -631,7 +644,6 @@ def pull(self, curr_fb_path, auth=None):
631644
stderr=PIPE,
632645
env = env,
633646
cwd=os.path.join(self.root_dir, curr_fb_path),
634-
env = env,
635647
)
636648
_, error = p.communicate()
637649

@@ -650,7 +662,7 @@ def push(self, remote, branch, curr_fb_path, auth=None):
650662
if (auth):
651663
env["GIT_TERMINAL_PROMPT"] = "1"
652664
p = git_auth_input_wrapper(
653-
command = ['git', 'push', remote, branch],
665+
command = 'git push {} {}'.format(remote, branch),
654666
cwd = os.path.join(self.root_dir, curr_fb_path),
655667
env = env,
656668
username = auth['username'],
@@ -665,7 +677,6 @@ def push(self, remote, branch, curr_fb_path, auth=None):
665677
stderr=PIPE,
666678
env = env,
667679
cwd=os.path.join(self.root_dir, curr_fb_path),
668-
env = env,
669680
)
670681
_, error = p.communicate()
671682

src/components/BranchHeader.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import * as React from 'react';
22

3-
import { Dialog } from '@jupyterlab/apputils';
4-
53
import { Git } from '../git';
64

75
import { CommitBox } from './CommitBox';
86

9-
import { GitAuthorForm } from './CommitAuthorBox';
10-
117
import { NewBranchBox } from './NewBranchBox';
128

139
import {

src/components/PathHeader.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import { GitPullPushDialog, Operation } from '../widgets/gitPushPull';
1818

1919
import { GitCredentialsForm } from './CredentialsBox';
2020

21-
import { GitCredentialsForm } from './CredentialsBox';
22-
2321
export interface IPathHeaderState {
2422
refresh: any;
2523
gitApi: Git;
@@ -99,7 +97,7 @@ export class PathHeader extends React.Component<
9997
let result = await dialog.launch();
10098
dialog.dispose();
10199
let retry = false;
102-
while (result.button.label === 'CANCEL') {
100+
while (result.button.label === 'Cancel') {
103101
let credentialsDialog = new Dialog({
104102
title: 'Git credentials required',
105103
body: new GitCredentialsForm(

src/git.ts

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export interface IGitLogResult {
126126
export interface IIdentity {
127127
name: string;
128128
email: string;
129+
}
129130

130131
/**
131132
* Interface for the Git Auth request.
@@ -144,16 +145,6 @@ export interface IGitClone {
144145
auth?: IGitAuth;
145146
}
146147

147-
/**
148-
* Structure for the request to the Git Commit API.
149-
*/
150-
export interface IGitCommit {
151-
commit_msg: string;
152-
top_repo_path: string;
153-
author_name?: string;
154-
author_email?: string;
155-
}
156-
157148
/**
158149
* Structure for the request to the Git Clone API.
159150
*/
@@ -193,14 +184,6 @@ export interface IGitCloneResult {
193184
message?: string;
194185
}
195186

196-
/**
197-
* Structure for the result of the Git Commit API.
198-
*/
199-
export interface IGitCommitResult {
200-
code: number;
201-
message?: string;
202-
}
203-
204187
/**
205188
* Structure for the result of the Git Push & Pull API.
206189
*/
@@ -474,30 +457,18 @@ export class Git {
474457
}
475458
}
476459
/** Make request to commit all staged files in repository 'path' */
477-
async commit(
478-
message: string,
479-
path: string,
480-
authorName: string = '',
481-
authorEmail: string = ''
482-
): Promise<IGitCommitResult> {
460+
async commit(message: string, path: string): Promise<Response> {
483461
try {
484-
let obj: IGitCommit = {
462+
let response = await httpGitRequest('/git/commit', 'POST', {
485463
commit_msg: message,
486464
top_repo_path: path
487-
};
488-
489-
if (authorName !== '' && authorEmail !== '') {
490-
obj.author_name = authorName;
491-
obj.author_email = authorEmail;
492-
}
493-
494-
let response = await httpGitRequest('/git/commit', 'POST', obj);
465+
});
495466
if (response.status !== 200) {
496467
return response.json().then((data: any) => {
497468
throw new ServerConnection.ResponseError(response, data.message);
498469
});
499470
}
500-
return response.json();
471+
return response;
501472
} catch (err) {
502473
throw ServerConnection.NetworkError;
503474
}

0 commit comments

Comments
 (0)