Skip to content

Commit

Permalink
doc: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
redstreet committed Aug 22, 2023
1 parent fc200f7 commit e09c759
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# Git remote helper for rclone-supported services

[![GitHub release](https://img.shields.io/github/release/datalad/git-remote-rclone.svg)](https://GitHub.com/datalad/git-remote-rclone/releases/) [![PyPI version fury.io](https://badge.fury.io/py/git-remote-rclone.svg)](https://pypi.python.org/pypi/git-remote-rclone)

This is a [Git remote helper](https://git-scm.com/docs/git-remote-helpers) for
backends supported by [rclone](https://rclone.org). In other words, this
helper makes it possible to push and pull to a large number of storage services
with no native Git support.

## Installation
```
pip3 install git-remote-rclone-reds
```
## Installation and Usage

- Visit the [rclone website](https://rclone.org) and follow the instructions for
installation of `rclone`, and configuration of access to the desired service(s).

## Usage
- Install this package:
```
pip3 install git-remote-rclone-reds
```
or place the `git-remote-rclone` executable provided here into the system path, such
that Git can find it.

Visit the [rclone website](https://rclone.org) and follow the instructions for
installation of `rclone`, and configuration of access to the desired
service(s). Install this package via pip (`pip install git-remote-rclone`), or
place the `git-remote-rclone` executable provided here into the system path,
such that Git can find it. Now it is possible to use URLs like
Now it is possible to use URLs like
`rclone://<remote>/<path-on-remote>` as push and pull URLs for Git.

For example, if access to a DropBox account has been configured as an rclone-remote
Expand Down
8 changes: 4 additions & 4 deletions git-remote-rclone
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3.11

import json
import os
Expand Down Expand Up @@ -108,14 +108,14 @@ class RCloneRemote(object):
raise RuntimeError('Accesing rclone remote failed: {}'.format(lsjson.stderr))

files = {i['Path']: i for i in json.loads(lsjson.stdout)}
# get filename of the file that looks like repo-SHA1.{tar.gz, 7z, ...}
# get filename of the file that looks like repo-SHA.tar.gz
repo_file = [i for i in files.keys() if i.startswith('repo') and i.endswith('.tar.gz')]

# error out if repo_file has more than one element
# We should never have more than one repo file
if len(repo_file) > 1:
raise RuntimeError('Multiple repo files found: {}'.format(repo_file))

# extract SHA1 pattern from repo-SHA1.tar.gz
# extract SHA from repo-SHA.tar.gz
if not repo_file:
self.log('No repo file found')
return repo_file[0][5:-len('.tar.gz')] if repo_file else ''
Expand Down

0 comments on commit e09c759

Please sign in to comment.