Spaces:
Sleeping
Sleeping
Upload 7 files
Browse files- app.py +1 -4
- push_helper.py +22 -0
app.py
CHANGED
|
@@ -236,10 +236,7 @@ class HFDavNonCollection(DAVNonCollection):
|
|
| 236 |
return 0
|
| 237 |
|
| 238 |
def get_etag(self):
|
| 239 |
-
|
| 240 |
-
mtime = lc.get("date", "")
|
| 241 |
-
size = self._info.get("size", 0)
|
| 242 |
-
return f'"{mtime}-{size}"'
|
| 243 |
|
| 244 |
def move_dest(self, dest_provider, dest_path, recursive, dry_run, environ):
|
| 245 |
"""Handle MOVE (rename)."""
|
|
|
|
| 236 |
return 0
|
| 237 |
|
| 238 |
def get_etag(self):
|
| 239 |
+
return None
|
|
|
|
|
|
|
|
|
|
| 240 |
|
| 241 |
def move_dest(self, dest_provider, dest_path, recursive, dry_run, environ):
|
| 242 |
"""Handle MOVE (rename)."""
|
push_helper.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Helper script to push git changes."""
|
| 3 |
+
import subprocess
|
| 4 |
+
import sys
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
env = os.environ.copy()
|
| 8 |
+
env["http_proxy"] = "http://127.0.0.1:1080"
|
| 9 |
+
env["https_proxy"] = "http://127.0.0.1:1080"
|
| 10 |
+
|
| 11 |
+
result = subprocess.run(
|
| 12 |
+
["git", "push", "origin", "main"],
|
| 13 |
+
cwd="hf_webdav/space-git",
|
| 14 |
+
env=env,
|
| 15 |
+
capture_output=True,
|
| 16 |
+
text=True,
|
| 17 |
+
timeout=120
|
| 18 |
+
)
|
| 19 |
+
print(result.stdout)
|
| 20 |
+
if result.stderr:
|
| 21 |
+
print(result.stderr, file=sys.stderr)
|
| 22 |
+
sys.exit(result.returncode)
|