Skip to content

Commit d340890

Browse files
authored
Merge pull request #88 from achilleas-k/annex-content-handling
Annex content handling
2 parents 7d48e73 + 8b2e9d1 commit d340890

File tree

7 files changed

+1060
-549
lines changed

7 files changed

+1060
-549
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77

88
# directories
99
dist
10+
11+
# macOS junk
12+
.DS_Store

dorelease.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,23 @@ def wait_for_ret():
7878
die("\nCancelled")
7979

8080

81-
def build(incbuild=False):
81+
def build():
8282
platforms = ["linux/amd64", "windows/386", "darwin/amd64"]
8383
print("--> Building binary for [{}]".format(", ".join(platforms)))
8484
verfile = "version"
8585
with open(verfile) as fd:
8686
verinfo = fd.read()
8787

8888
version["version"] = re.search(r"version=([v0-9\.]+)", verinfo).group(1)
89-
version["build"] = re.search(r"build=([0-9]+)", verinfo).group(1)
89+
cmd = ["git", "rev-list", "--count", "HEAD"]
90+
version["build"] = int(check_output(cmd).strip().decode())
9091
cmd = ["git", "rev-parse", "HEAD"]
9192
version["commit"] = check_output(cmd).strip().decode()
92-
if incbuild:
93-
print("--> Updating version file")
94-
version["build"] = "{:05d}".format(int(version["build"]) + 1)
95-
newinfo = "version={version}\nbuild={build}\n".format(**version)
96-
print(newinfo)
97-
with open(verfile, "w") as fd:
98-
fd.write(newinfo)
9993
print(("Version: {version} "
100-
"Build: {build} "
94+
"Build: {build:06d} "
10195
"Commit: {commit}").format(**version))
10296
ldflags = ("-X main.version={version} "
103-
"-X main.build={build} "
97+
"-X main.build={build:06d} "
10498
"-X main.commit={commit}").format(**version)
10599
# cmd = ["go", "build", "-ldflags", ldflags, "-o", "gin"]
106100
output = os.path.join(destdir, "{{.OS}}-{{.Arch}}", "gin")
@@ -164,7 +158,7 @@ def get_appveyor_artifact_url():
164158

165159
def get_git_for_windows():
166160
win_git_url = ("https://github.com/git-for-windows/git/releases/download/"
167-
"v2.12.0.windows.1/PortableGit-2.12.0-32-bit.7z.exe")
161+
"v2.13.3.windows.1/PortableGit-2.13.3-32-bit.7z.exe")
168162
return download(win_git_url)
169163

170164

@@ -386,8 +380,7 @@ def main():
386380
os.makedirs(os.path.join(destdir, "downloads"), exist_ok=True)
387381
os.makedirs(pkgdir, exist_ok=True)
388382

389-
incbuild = "--incbuild" in sys.argv
390-
binfiles = build(incbuild)
383+
binfiles = build()
391384
load_etags()
392385
annexsa_file = download_annex_sa()
393386
win_git_file = get_git_for_windows()
@@ -415,6 +408,8 @@ def link_latest(lst):
415408
for l in lst:
416409
latestname = l.replace(version["version"], "latest")
417410
print("Linking {} to {}".format(l, latestname))
411+
if os.path.exists(latestname):
412+
os.unlink(latestname)
418413
os.link(l, latestname)
419414

420415
print("------------------------------------------------")

help.go

+129-37
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ Options:
1212
--version Client version
1313
1414
Commands:
15-
login [<username>]
16-
logout
17-
create [<name>] [<description>]
18-
get <repopath>
19-
ls [<directory>]
20-
upload
21-
download
22-
repos [<username>]
23-
info [<username>]
24-
keys [-v | --verbose]
25-
keys --add <filename>
26-
help <command>
15+
login [<username>] | Login to the GIN services
16+
logout | Logout from the GIN services
17+
create [<name>] [<description>] | Create a repository on the remote server and clone it
18+
get <repopath> | Retrieve (clone) a repository from the remote server
19+
ls [-s, --short] [<filenames>] | List the sync status of files in a local repository
20+
unlock [<filenames>] | Unlock files for editing
21+
lock [<filenames>] | Lock files
22+
upload [<filenames>] | Upload local changes to a remote repository
23+
download [<filenames>] | Download the content of files from a remote repository
24+
remove-content [<filenames>] | Remove the content of local files that have already been uploaded
25+
rmc [<filenames>] | Synonym for remove-content
26+
repos [<username>] | List available remote repositories
27+
info [<username>] | Print user information
28+
keys [-v, --verbose] | List the keys associated with the logged in user
29+
keys --add <filename> | Add/upload a new public key to the GIN services
30+
help <command> | Get help for individual commands
2731
2832
Use 'help' followed by a command to see full description of the command.
2933
`
@@ -121,15 +125,15 @@ EXAMPLES
121125

122126
const lsHelp = `USAGE
123127
124-
gin ls [<directory>]...
128+
gin ls [--short, -s] [<filenames>]...
125129
126130
DESCRIPTION
127131
128132
List one or more files or the contents of directories and the status of the
129133
files within it. With no arguments, lists the status of the files under the
130134
current directory. Directory listings are performed recursively.
131135
132-
The meaning of the status abbreviations is as follows:
136+
In the short form, the meaning of the status abbreviations is as follows:
133137
OK: The file is part of the GIN repository and its contents are
134138
synchronised with the server.
135139
NC: The local file is a placeholder and its contents have not been
@@ -142,38 +146,122 @@ DESCRIPTION
142146
143147
ARGUMENTS
144148
145-
<directory>
149+
--short, -s
150+
Print listing in short form.
151+
152+
<filenames>
146153
One or more directories or files to list.
147154
`
148155

156+
const unlockHelp = `USAGE
157+
158+
gin unlock [<filenames>]...
159+
160+
DESCRIPTION
161+
162+
Unlock one or more files for editing. Files added to the repository are
163+
left in a locked state, which allows reading but prevents editing. In order
164+
to edit or write to a file, it must first be unlocked. When done editing,
165+
it is recommended that a file be locked again, using the 'lock' command,
166+
which records changes in the repository.
167+
168+
After performing an 'upload', 'download', or 'get', affected files are
169+
reverted to a locked state.
170+
171+
Unlocking a file takes longer depending on the size of the file.
172+
173+
ARGUMENTS
174+
175+
<filenames>
176+
One or more directories or files to unlock.
177+
`
178+
179+
const lockHelp = `USAGE
180+
181+
gin lock [<filenames>]...
182+
183+
DESCRIPTION
184+
185+
Lock one or more files after editing. After unlocking files for editing,
186+
using the 'unlock' command, it is recommended that they be locked again.
187+
This records any changes made and prepares a file for upload to the GIN
188+
server.
189+
190+
Locked files are replaced by symbolic links in the working directory.
191+
192+
After performing an 'upload', 'download', or 'get', affected files are
193+
reverted to a locked state.
194+
195+
Unlocking a file takes longer depending on the size of the file.
196+
197+
ARGUMENTS
198+
199+
<filenames>
200+
One or more directories or files to lock.
201+
`
202+
149203
const uploadHelp = `USAGE
150204
151-
gin upload
205+
gin upload [<filenames>]...
152206
153207
DESCRIPTION
154208
155209
Upload changes made in a local repository clone to the remote repository on
156210
the GIN server. This command must be called from within the local
157-
repository clone. All changes made will be sent to the server, including
158-
addition of new files, modifications and renaming of existing files, and
159-
file deletions.
211+
repository clone. Specific files or directories may be specified.
212+
All changes made will be sent to the server, including addition of new
213+
files, modifications and renaming of existing files, and file deletions.
214+
With no arguments, uploads the changes made under the working directory,
215+
recursively.
216+
217+
ARGUMENTS
218+
219+
<filenames>
220+
One or more directories of files to upload and update.
160221
161-
This command takes no arguments.
162222
`
163223

164224
const downloadHelp = `USAGE
165225
166-
gin download
226+
gin download [<filenames>]...
167227
168228
DESCRIPTION
169229
170-
Download changes made in the remote repository on the GIN server to the
171-
local repository clone. This command must be called from within the
172-
local repository clone. All changes made on the remote server will
173-
be retrieved, including addition of new files, modifications and renaming
174-
of existing files, and file deletions.
230+
Download the content of the listed files. The download command is intended
231+
to be used to retrieve the content of placeholder files in a local
232+
repository. This command must be called from within the local repository
233+
clone. With no arguments, downloads the content for all files under the
234+
working directory, recursively.
175235
176-
This command takes no arguments.
236+
ARGUMENTS
237+
238+
<filenames>
239+
One or more names of files or directories to retrieve.
240+
`
241+
242+
const rmcHelp = `USAGE
243+
244+
gin remove-content [<filenames>]...
245+
gin rmc [<filenames>]...
246+
247+
DESCRIPTION
248+
249+
Remove the content of local files. This command will not remove the content
250+
of files that have not been already uploaded to a remote repository, even
251+
if the user specifies such files exclusively. Removed content can be
252+
retrieved from the server by using the 'gin download' command. With no
253+
arguments, removes the content of all files under the current working
254+
directory, as long as they have been safely uploaded to a remote
255+
repository.
256+
257+
Note that after removal, placeholder files will remain in the local
258+
repository. These files appear as 'No Content' when running the 'gin ls'
259+
command.
260+
261+
ARGUMENTS
262+
263+
<filenames>
264+
One or more names of files or directories to remove.
177265
`
178266

179267
const reposHelp = `USAGE
@@ -257,16 +345,20 @@ EXAMPLES
257345
`
258346

259347
var cmdHelp = map[string]string{
260-
"login": loginHelp,
261-
"logout": logoutHelp,
262-
"create": createHelp,
263-
"get": getHelp,
264-
"ls": lsHelp,
265-
"upload": uploadHelp,
266-
"download": downloadHelp,
267-
"repos": reposHelp,
268-
"info": infoHelp,
269-
"keys": keysHelp,
348+
"login": loginHelp,
349+
"logout": logoutHelp,
350+
"create": createHelp,
351+
"get": getHelp,
352+
"ls": lsHelp,
353+
"unlock": unlockHelp,
354+
"lock": lockHelp,
355+
"upload": uploadHelp,
356+
"download": downloadHelp,
357+
"remove-content": rmcHelp,
358+
"rmc": rmcHelp,
359+
"repos": reposHelp,
360+
"info": infoHelp,
361+
"keys": keysHelp,
270362
}
271363

272364
// ex: set cc=80:

0 commit comments

Comments
 (0)