How to use Git branches with Pydev?

Anonymous
2010-09-24
2013-03-15

  • Anonymous
    2010-09-24

    Hello,

    We have a Git repository with multiple branches. Each branch should have its own Pydev project because their sys.path is different sometimes (different dependencies) and we use the Buildout recipe pb.recipes.pydev to update the .pydevproject file accordingly.

    However, given that in GIt all the branches would be available from the same path and therefore only one of them can be active at a time, it seems like I would only be able to have one Pydev project for all the branches, which means that every time I switch branches, I'd have to go to "Project" -> "Properties" -> "PyDev - PYTHONPATH" -> "Force restore internal info" and restart Eclipse. What's worse, I'd have to check in the .pydevproject file, which is not ideal given that we're a team.

    The other solution would be to have one Git repository per branch, and have a different checkout on each repository, which is not exactly the way things should be done in Git.

    Any suggestions? How do other people do?

    Thanks in advance.

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2010-09-28

    > What's worse, I'd have to check in the .pydevproject file, which is not ideal given that we're a team.

    Actually, especially given that you're in a team, ideally you'd commit that file… I believe that by committing that file, your problems would be solved (when that file is updated, you shouldn't have to restart eclipse, as it should understand that the file changed and act accordingly).

    Note that the .project and .pydevproject files are meant to be checked in the repository (otherwise, if you want to keep it local, then you really have to keep updating things manually as you change things) - the only thing is that you shouldn't commit that file with absolute paths (always with string substitution variables, which can be configured on a per-interpreter basis and relative paths).

    Cheers,

    Fabio