dirk-thomas/vcstool

vcs export fails to add nesting path prefix to nested repos

Closed this issue · 5 comments

Starting with an existing nested repository structure in ~/dev:

repository-group
├── .git
├── nested-repo-one
│   └── .git
└── nested-repo-two
    └── .git

and running

~/dev $ vcs export --nested repository-group

the result is

repositories:
  repository-group:
    type: git
    url: https://<url>.git
    version: master
  nested-repo-one:
    type: git
    url: https://<url>.git
    version: develop
  nested-repo-two:
    type: git
    url: https://<url>.git
    version: develop

but should be

repositories:
  repository-group:
    type: git
    url: https://<url>.git
    version: master
  repository-group/nested-repo-one:
    type: git
    url: https://<url>.git
    version: develop
  repository-group/nested-repo-two:
    type: git
    url: https://<url>.git
    version: develop

I had forgotten about the export command for a while. @dirk-thomas thanks for reminding me. Since we use nested repos in the IHMC build framework, this breaks that convenience for me. I'm guessing it's an easy fix. 😄

Thanks for reporting this. Can you try passing the parent directory instead?

vcs export --nested repository-group/..

That should contain the nested repos. Obviously it would contain the unwanted sibling directories though. So this would only be a temporary workaround until the problem is addressed.

I'm guessing it's an easy fix.

We will see about that 😉

Please try the patch from #102 and comment if it resolves the problem for you.

vcs export --nested repository-group/..

That works as expected.

I'm not sure if your patch just isn't working or I'm having trouble actually running the new code. I cloned vcstool and ran chmod +x setup.sh && ./setup.sh and tried, then tried sudo python setup.py develop and tried, and even tried ./vcstool/scripts/vcs-export --nested repository-group and in all cases I got the same result as in the initial post; missing path prefixes.

I tried changing the version in vcstool to see if I could verify I was running the correct branch, but it always prints vcs 0.2.1, so maybe I'm not managing to actually run the new code.

I'm on Arch Linux, consuming vcstool from the AUR package: https://aur.archlinux.org/packages/python-vcstool/

I wouldn't recommend to install a version for testing using sudo. Instead you could use a virtual env.

When you invoke vcs-export directly you need to extend the PYTHONPATH to contain the directory of this repository so that it picks up the modified Python modules.

The version number wouldn't be different on the branch - it is still the same as the latest released version.

You might want to add a simple print call in the export function to confirm that you are actually using the code from the custom branch.

Whew.

A source setup.sh did the trick. For some reason I was doing ./setup.sh so the environment changes died with the process. 😅 It's a Monday.

It worked! The paths prefix correctly and I got my print message. Thanks!