AdvancedPhotonSource / GSAS-II

Home for GSAS-II: crystallographic and diffraction-based structural characterization of materials
Other
33 stars 14 forks source link

developer menu command to switch to a remote branch #30

Closed briantoby closed 4 months ago

briantoby commented 5 months ago

To facilitate testing of branches, it would be useful to have a menu command (available only in debug mode) that allows one to switch to a remote branch (and back to master)

Steps needed:

briantoby commented 5 months ago

This is not working. I'm not seeing any branches and fetch is not finding them; nor does git branch -r.

The problem here is that use of a shallow install causes git to ignore all but the master branch. FWIW, git fetch --unshallow pulls over all the history (takes a while) and still does not get the branches

However, this does get the branches:

git clone git@github.com:AdvancedPhotonSource/GSAS-II.git /tmp/g2 --depth 100
cd /tmp/g2
git remote set-branches origin '*'
git fetch   (or git fetch -v --depth 100)
git branch -r   
git checkout log

Python commands:

import git
repo = git.Repo('/tmp/g2')
repo.git.remote('set-branches','origin','*')
repo.git.fetch()
branchlist = [i.strip() for i in repo.git.branch('-r').split('\n') if '->' not in i]
briantoby commented 4 months ago

This was added in 006b568. All branches updated to include this.