Skip to content

Instantly share code, notes, and snippets.

@willhardy
Created August 9, 2011 23:19
Show Gist options
  • Save willhardy/1135474 to your computer and use it in GitHub Desktop.
Save willhardy/1135474 to your computer and use it in GitHub Desktop.
epio-client: upload cp with .epioexclude
diff -r 8ce6f774762a epio/commands/upload.py
--- a/epio/commands/upload.py Tue Aug 09 20:57:55 2011 +0100
+++ b/epio/commands/upload.py Wed Aug 10 00:46:04 2011 +0200
@@ -18,19 +18,13 @@
repo_dir = tempfile.mkdtemp(prefix="epio-upload-")
try:
# Copy the files across
+ additional_excludes = ['.git', '.gitignore', '.svn', '.epio-git', '.hg']
+ base_command = ["rsync", "-a", "--exclude-from=.epioignore", ".", repo_dir]
subprocess.Popen(
- ["cp", "-R", ".", repo_dir],
+ base_command + ["--exclude=%s" % ex for ex in additional_excludes],
stdout=subprocess.PIPE,
cwd = os.getcwd(),
).communicate()
- # Remove any old git repo
- env = dict(os.environ)
- subprocess.Popen(
- ["rm", "-rf", ".git"],
- env=env,
- stdout=subprocess.PIPE,
- cwd=repo_dir,
- ).communicate()
# Init the git repo
subprocess.Popen(
["git", "init"],
@@ -46,13 +40,6 @@
fh.write(fh2.read())
fh2.close()
fh.close()
- # Remove any gitignore file
- subprocess.Popen(
- ["rm", "-f", ".gitignore"],
- env=env,
- stdout=subprocess.PIPE,
- cwd=repo_dir,
- ).communicate()
# Set configuration options
fh = open(os.path.join(repo_dir, ".git/config"), "w")
fh.write("[core]\nautocrlf = false\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment