Comments (12)
No problem at all :). We should improve the documentation.
Let me write here a short example for now:
Lets say we want to move 'public' folder from git.origin but we don't want to export 'public/SECRET.txt'
origin_files would be:
origin_files = glob(["public/**"], exclude = ["public/SECRET.txt"])
Note that we exclude public/SECRET.txt and not just SECRET.txt. This is because the include part can contain multiple folders.
Now lets say we want to move everything to the root of the destination:
transformations = [
core.move("public", "")
]
Now lets say we have in the destination a README.txt file that we don't want to delete:
destination_files= glob(["**"], exclude = ["README.txt"])
Now lets say that instead we want to keep it in the 'public' folder in the destination. You would not include any transformations (You can skip transformations = ...) and instead you would write the following destinations_files:
destination_files= glob(["public/**"], exclude = ["public/README.txt"])
Or if you don't have a README.txt inside public:
destination_files= glob(["**"])
from copybara.
The problem is that you are using a ssh key with password and Copybara doesn't have the ability (For now) to ask for a password in the middle of the process. Currently we only support either using .netrc with your password/token (works with 2FA) or ssh keys without password.
The only think I can think of as a workaround is to checkout from your remote in a wrapper script and then use copybara with the local repo. If you are using cached credentials for git, maybe you could do something like:
#!bin/bash
git ls-remote internal_repo
copybara ...
To force the first git invocation to ask for the credentials if needed.
from copybara.
Hmmm, lemme see what I can around this. I figured it might be something like that.
from copybara.
This did not resolve the issue, I switched to ssh key without password to try it out and got this:
770 jeffryhesse:IQreport (master *)$ copybara copy.bara.sky --force
Copybara source mover (Version: Unknown version)
Task: Git Origin: Initializing local repo
WARN: Cannot find last imported revision, but proceeding because of --force flag
Task: Moving
ERROR: Files already exist in /Users/jeffryhesse/copybara/temp/workdir5707807481329282041/checkout:
from copybara.
K,
The second part of the error:
ERROR: Files already exist in /Users/jeffryhesse/copybara/temp/workdir5707807481329282041/checkout:
is expected.
This move doesn't make sense:
core.move("", ""),
The reason for the failure is that we have a check that doesn't allow to move things like:
foo/bar/x
foo/baz/z
core.move("foo","foo/bar")
since it is normally a mistake.
from copybara.
Interesting. There isn't a ton of docs around this stuff so sorry for the question spamming via issues. What does the move become then? Is it source to destination? If you want to move things basically identically, what's the way to approach that? Basically I'm trying to move a specific folder from an internal repo into the root of a new repo.
from copybara.
Once I get all this working I'm going to submit a PR with some docs for you all.
from copybara.
That would be great. Thanks!!
from copybara.
That worked! Now I need to figure out how to maintain the previous author (one of the big reasons I'm using Copybara).
from copybara.
This all worked perfectly. I'm going to open a PR with some of this stuff for examples, etc... and then you can close this issue if you'd like.
from copybara.
Thanks!!
from copybara.
I came here by googling for that error message. My solution was to use overwrite=True
. Just in case someone else comes here and is as impatient as me when reading the move reference:
transformations = [
core.move("README-public.md", "README.md", overwrite=True)
],
from copybara.
Related Issues (20)
- Raising PR from one SoT repo to multiple destination repos HOT 1
- PR cannot be found when `--github-use-repo` is specified. HOT 2
- Is it safe to use experimental_custom_rev_id ? HOT 5
- maintain git history but remove commits in which no origin files are present HOT 1
- best way to handle gradually open-sourcing multiple parts of a repo? HOT 1
- Why 'user.name' and/or 'user.email' must be configured ? HOT 7
- Passing a Variable to copybara.sky in Dockerized Copybara HOT 2
- Initial import of existing repo and ITERATIVE mode usage question HOT 3
- Compiling Copybara through Bazel HOT 1
- Calling different sky files from copy.bara.sky HOT 4
- Submodules appear as regular directories HOT 1
- Package for Homebrew
- Add version tags to the repo to signal packagers that the software is stable
- What is the difference between uberjar and ordinary build?
- Compile standalone binary
- lfs support for git.destination
- Unable to build hermetically / without local java HOT 3
- Build failed use docker build HOT 2
- ITERATIVE mode only copies merge commits HOT 1
- Unexpected message regarding a canonical reproducible form
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from copybara.