Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Follow symlinks when finding unmanaged repos#106

Closed
jacobperron wants to merge 1 commit intovcstools:masterfrom
jacobperron:follow-symlinks
Closed

Follow symlinks when finding unmanaged repos#106
jacobperron wants to merge 1 commit intovcstools:masterfrom
jacobperron:follow-symlinks

Conversation

@jacobperron
Copy link
Copy Markdown

I found this helpful for one of my use cases that involves a workspace containing symlinks to repos.

The resultant yaml file contains paths from the symlinks as local names, for example:

- git:
    local-name: path/to/repo
    uri: https://myrepository.git

wstool update works as expected.

@coveralls
Copy link
Copy Markdown

coveralls commented Oct 13, 2017

Coverage Status

Coverage decreased (-0.1%) to 81.891% when pulling 14cffcc on jacobperron:follow-symlinks into 3a6a2d3 on vcstools:master.

@jayvdb
Copy link
Copy Markdown
Contributor

jayvdb commented Nov 18, 2017

Are you checking to make sure the symlink doesnt appear inside another repo?
I think that is necessary to avoid messy configurations.

The way gitshelf handles symlinks inside another repo is nice.
The repo needs to be a top level entity inside the workspace.
Then another top level entity is added to manage the symlink appearing inside one repo, linking to another repo in the workspace.

@jacobperron
Copy link
Copy Markdown
Author

jacobperron commented Nov 21, 2017

Is the following directory structure an example of the case you are describing?

workspace
  |-src
  |  |-top_level_repo
  |  |  |-symlink_to_repo
  |  |  |-.git/

I'm not sure if there are any explicit checks for symlinks appearing inside another repo, but I did a quick test with the above directory structure replacing symlink_to_repo with, and without, a symlink to a repo and there appears to be no change in behaviour.

Running the following commands (with and without a symlink) produces the same result:

wstool init
wstool scrape
wstool update

Results in the following yaml file:

- git:
    local-name: top_level_git
    uri: git@top_level_git.git

So it appears repos within repos are ignored. Only the top level repo is considered.

@jacobperron
Copy link
Copy Markdown
Author

jacobperron commented Nov 21, 2017

The case where the symlink points to a repo inside another repo appears to work as expected as well:

workspace
  |-src
  |  |-symlink_to_repo -> /path/to/top_level_repo/another_repo/

The symlinked repo is managed, not the top level repo.

@jacobperron
Copy link
Copy Markdown
Author

I just noticed that this solution does not work with if the link is pointing to a directory that is not the root of the repo (e.g. a package contained inside a metapackage).

@rhaschke
Copy link
Copy Markdown

rhaschke commented May 9, 2019

Is there a particular reason that this is not yet merged?
I was missing the ability to follow symlinks as well.

unmanaged_paths = []
scm_clients = {SvnClient: 'svn', GitClient: 'git', BzrClient:'bzr', HgClient:'hg'}
for root, dirs, files in os.walk(path):
for root, dirs, files in os.walk(path, followlinks=True):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be possible to add a test to show this new feature. There are already some good tests in this repo.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have resources to add a test.
By the way, what would you like to test here? os.walk is a system function, that should be tested upstream.

@dirk-thomas
Copy link
Copy Markdown
Contributor

Closing since the repository is about to be archived: see #154.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants