Skip to content

Commit 2a1629f

Browse files
committed
Merge branch 'master' of https://github.com/jupyterlab/jupyterlab-git into refactor-commit-box
2 parents aa8eede + d6b27c6 commit 2a1629f

File tree

6 files changed

+54
-37
lines changed

6 files changed

+54
-37
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,45 @@ jupyter lab build
2828

2929
### Troubleshooting
3030

31-
- When you run JupyterLab, if you can see the Git sidepanel UI but you cannot get it to work, you may need to explicitly enable the serverextension by running:
31+
Before consulting the following list, be sure the server extension and the frontend extension have the same version by executing the following commands:
3232

3333
```bash
34-
jupyter serverextension enable --py jupyterlab_git
34+
jupyter serverextension list
35+
jupyter labextension list
3536
```
3637

38+
- **Issue**: the Git panel does not recognize that you are in a Git repository.
39+
40+
Possible fixes:
41+
42+
- Be sure to be in a Git repository in the filebrowser tab
43+
44+
- Check the server log. If you see a warning with a 404 code similar to:
45+
`[W 00:27:41.800 LabApp] 404 GET /git/server_root?1576081660665`
46+
47+
Explicitly enable the server extension by running:
48+
```bash
49+
jupyter serverextension enable --py jupyterlab_git
50+
```
51+
52+
- If you are using JupyterHub or some other technologies requiring an initialization script which includes the jupyterlab-git extension, be sure to install both the frontend and the server extension **before** launching JupyterLab.
53+
54+
- **Issue**: the Git panel is not visible.
55+
56+
Possible fixes:
57+
58+
- Check that the JupyterLab extension is installed:
59+
60+
```bash
61+
jupyter labextension list
62+
```
63+
64+
If you don't see `@jupyterlab/git v... enabled OK` in the list, explicitly install the jupyter labextension by running:
65+
66+
```bash
67+
jupyter labextension @jupyterlab/git
68+
```
69+
3770
## Development
3871
3972
### Contributing

jupyterlab_git/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1+
"""Initialize the backend server extension
12
"""
2-
Initialize the backend server extension
3-
"""
3+
# need this in order to show version in `jupyter serverextension list`
4+
from ._version import __version__
5+
46
from jupyterlab_git.handlers import setup_handlers
57
from jupyterlab_git.git import Git
68

79

810
def _jupyter_server_extension_paths():
9-
"""
10-
Declare the Jupyter server extension paths.
11+
"""Declare the Jupyter server extension paths.
1112
"""
1213
return [{"module": "jupyterlab_git"}]
1314

1415

1516
def load_jupyter_server_extension(nbapp):
16-
"""
17-
Load the Jupyter server extension.
17+
"""Load the Jupyter server extension.
1818
"""
1919
git = Git(nbapp.web_app.settings['contents_manager'])
2020
nbapp.web_app.settings["git"] = git

src/components/PathHeader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export class PathHeader extends React.Component<IPathHeaderProps> {
6868
/>
6969
<button
7070
className={classes(repoRefreshStyle, 'jp-Icon-16')}
71+
title={'Refresh the repository to detect local and remote changes'}
7172
onClick={() => this.props.refresh()}
7273
/>
7374
</div>

src/components/SinglePastCommitInfo.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export class SinglePastCommitInfo extends React.Component<
169169
discardFileButtonStyle
170170
)}
171171
onClick={this.showDeleteCommit}
172+
title="Discard changes introduced by this commit"
172173
/>
173174
<button
174175
className={classes(
@@ -177,6 +178,7 @@ export class SinglePastCommitInfo extends React.Component<
177178
revertButtonStyle
178179
)}
179180
onClick={this.showResetToCommit}
181+
title="Discard changes introduced *after* this commit"
180182
/>
181183
</div>
182184
<div>

src/gitMenuCommands.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,25 @@ export function addCommands(
2828
const { commands, shell } = app;
2929

3030
/**
31-
* Add open terminal and run command
32-
*
33-
* Argument 'cmd' can be passed at the execute function to specify the command to execute
31+
* Add open terminal in the Git repository
3432
*/
3533
commands.addCommand(CommandIDs.gitTerminalCommand, {
36-
label: 'Git Command in Terminal',
37-
caption: 'Open a new terminal to perform git command',
34+
label: 'Open Terminal in Git Repository',
35+
caption: 'Open a New Terminal in the Git Repository',
3836
execute: async args => {
39-
let changeDirectoryCommand =
40-
model.pathRepository === null
41-
? ''
42-
: 'cd "' + model.pathRepository.split('"').join('\\"') + '"';
43-
let gitCommand = (args['cmd'] as string) || '';
44-
let linkCommand =
45-
changeDirectoryCommand !== '' && gitCommand !== '' ? '&&' : '';
46-
4737
const main = (await commands.execute(
4838
'terminal:create-new',
4939
args
5040
)) as MainAreaWidget<ITerminal.ITerminal>;
5141

52-
const terminal = main.content;
5342
try {
54-
terminal.session.send({
55-
type: 'stdin',
56-
content: [changeDirectoryCommand + linkCommand + gitCommand + '\n']
57-
});
43+
if (model.pathRepository !== null) {
44+
const terminal = main.content;
45+
terminal.session.send({
46+
type: 'stdin',
47+
content: [`cd "${model.pathRepository.split('"').join('\\"')}"\n`]
48+
});
49+
}
5850

5951
return main;
6052
} catch (e) {

src/model.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -681,17 +681,6 @@ export class GitExtension implements IGitExtension {
681681
}
682682
}
683683

684-
performDiff(filename: string, revisionA: string, revisionB: string) {
685-
let extension = PathExt.extname(filename).toLocaleLowerCase();
686-
if (this._diffProviders[extension] !== undefined) {
687-
this._diffProviders[extension](filename, revisionA, revisionB);
688-
} else if (this.commands) {
689-
this.commands.execute('git:terminal-cmd', {
690-
cmd: 'git diff ' + revisionA + ' ' + revisionB
691-
});
692-
}
693-
}
694-
695684
/**
696685
* Register a new diff provider for specified file types
697686
*

0 commit comments

Comments
 (0)