Open tylerjw opened 4 years ago
The diff at the PR I linked solves my problem but I think ideally the import command should have an option for calling checkout after setting the remote and cloning (or however it works).
If you want the latest code, why do you specify a commit?
I want the latest code in other repos that have branches for thier version. The UR repo is my special case where they changed something that broke our local environment and I haven't had time to go fix it so I did this temporarily. I then discovered that calling vcs pull
to get the latest code (in my workspace) in the other repos caused a non-zero return value because of this one.
Because we are also re-using docker images from previous runs we have the issue where the code in the workspace is out of date.
The current import
logic is unfortunately not suited for this use case. I would certainly be nice if it would support it.
I'd like some way to skip pulling if the version was set explicitly like this.
When invoking vcs pull
there is no explicit version since there is no input yaml file. The command solely operates on the filesystem. Atm it simply invokes git pull
and returns its output and return code. The logic could be changed to not invoke git
at all if the working copy is not tracking any branch.
Another option would be to have import run the fast forward somehow, maybe a fetch and reset to the remote version?
Resetting to the remote version is something I think import
shouldn't do without an explicit option (maybe --force
). Attempting a merge --ff-only
sounds reasonable.
@tylerjw Please give #166 a try which only shows the message about You are not currently on a branch...
as a warning (in yellow) rather than as an error (in red) and therefore doesn't result in a non-zero return code (which is what git
returns for trying to pull a detached HEAD).
industrial_ci is using vcstool to import from .repos or .rosinstall files into a workspace. Because we are also re-using docker images from previous runs we have the issue where the code in the workspace is out of date. The easy solution to that is to have vcs tool call pull after import. This presents a problem if the version was specified with a hash. If this was done we get a failure like this:
I know that it is just running pull recursively. I'd like some way to skip pulling if the version was set explicitly like this. A way to do this with a custom git command would work too.
Another option would be to have import run the fast forward somehow, maybe a fetch and reset to the remote version?