Skip to content

Commit e7ab244

Browse files
Frederic Collonvaltelamonian
authored andcommitted
Simplify GitWidget
Refractor clone button Begin propagating model in react tree Simplify `PathHeader` Simplify clone button Rework commands Remove use of file browser in `FileList` Switch from `Git` to `model.gitApi` update `tsconfig` settings Use proper extension for style files Improve typing Integrate API call in model Undo refresh definition BUG forget to set `_pathRepository` for `null` Extract helpers from DOM propagation Better naming for current folder status component Remove unused argument Remove useless intermediate component Simplify GitPanel state Move `CommitBox` in `FileList` Simplify `CommitBox` Disconnect optionally the model from the UI Fix unit tests Remove print statement in handlers Improve styling Split the refresh method
1 parent 53ee473 commit e7ab244

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2917
-2859
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,4 @@ node_modules/
107107
package-lock.json
108108
MANIFEST
109109
jupyterlab_git/labextension/*.tgz
110+
*.tsbuildinfo

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ cache:
77
- /home/travis/.yarn-cache/
88
before_install:
99
- nvm install 10
10-
install: pip install pytest "jupyterlab~=1.0"
10+
install: pip install pytest "jupyterlab~=1.1"
1111
script:
1212
- python setup.py sdist
13+
# Install the extension ensuring the cache is unused
1314
- pip install jupyterlab_git[test] --pre --no-index --find-links=dist --no-deps --no-cache-dir -v
15+
# Install the extension dependencies
1416
- pip install jupyterlab_git[test]
1517
- jupyter labextension list
1618
- jupyter lab build

jest.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
var tsConfig = require ('./tsconfig.json');
2+
3+
var tsOptions = tsConfig["compilerOptions"];
4+
// Need as the test folder is not visible from the src folder
5+
tsOptions["rootDir"] = null;
6+
17
module.exports = {
28
automock: false,
39
moduleNameMapper: {
@@ -7,12 +13,12 @@ module.exports = {
713
preset: 'ts-jest/presets/js-with-babel',
814
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
915
setupFiles: ['<rootDir>/testutils/jest-setup-files.js'],
10-
testPathIgnorePatterns: ['/dev_mode/', '/lib/', '/node_modules/'],
16+
testPathIgnorePatterns: ['/lib/', '/node_modules/'],
1117
testRegex: '/tests/test-.*/.*.spec.ts[x]?$',
1218
transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'],
1319
globals: {
1420
'ts-jest': {
15-
tsConfig: 'tsconfig.json'
21+
tsConfig: tsOptions
1622
}
1723
}
1824
};

jupyterlab_git/handlers.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ def post(self):
142142
POST request handler,
143143
fetches Commit SHA, Author Name, Commit Date & Commit Message.
144144
"""
145-
current_path = self.get_json_body()["current_path"]
146-
result = self.git.log(current_path)
145+
body = self.get_json_body()
146+
current_path = body["current_path"]
147+
history_count = body.get("history_count", 25)
148+
result = self.git.log(current_path, history_count)
147149
self.finish(json.dumps(result))
148150

149151

@@ -179,9 +181,6 @@ def post(self):
179181
top_repo_path = self.get_json_body()["top_repo_path"]
180182
my_output = self.git.diff(top_repo_path)
181183
self.finish(my_output)
182-
print("GIT DIFF")
183-
print(my_output)
184-
185184

186185
class GitBranchHandler(GitHandler):
187186
"""
@@ -289,12 +288,10 @@ def post(self):
289288
top_repo_path = data["top_repo_path"]
290289
if data["checkout_branch"]:
291290
if data["new_check"]:
292-
print("to create a new branch")
293291
my_output = self.git.checkout_new_branch(
294292
data["branchname"], top_repo_path
295293
)
296294
else:
297-
print("switch to an old branch")
298295
my_output = self.git.checkout_branch(data["branchname"], top_repo_path)
299296
elif data["checkout_all"]:
300297
my_output = self.git.checkout_all(top_repo_path)
@@ -418,7 +415,6 @@ def post(self):
418415
"""
419416
top_repo_path = self.get_json_body()["top_repo_path"]
420417
my_output = self.git.add_all_untracked(top_repo_path)
421-
print(my_output)
422418
self.finish(my_output)
423419

424420
class GitChangedFilesHandler(GitHandler):

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build:lib": "tsc",
1818
"build:all": "jlpm run build:labextension",
1919
"clean": "jlpm run clean:lib",
20-
"clean:lib": "rimraf lib",
20+
"clean:lib": "rimraf lib && rimraf tsconfig.tsbuildinfo",
2121
"clean:labextension": "rimraf jupyterlab_git/labextension",
2222
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
2323
"prepare": "jlpm run clean && jlpm run build",
@@ -68,6 +68,7 @@
6868
"devDependencies": {
6969
"@babel/core": "^7.5.0",
7070
"@babel/preset-env": "^7.5.0",
71+
"@types/codemirror": "^0.0.79",
7172
"@types/enzyme": "3.1.15",
7273
"@types/jest": "^24",
7374
"@types/react": "~16.8.13",

0 commit comments

Comments
 (0)