Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper function to checkout a branch on github from a web browser #494

Closed
kendonB opened this issue May 5, 2019 · 9 comments
Closed

Helper function to checkout a branch on github from a web browser #494

kendonB opened this issue May 5, 2019 · 9 comments
Assignees
Labels
Help Wanted Seeking co-contributor New Feature A new feature that is not currently implemented.

Comments

@kendonB
Copy link
Collaborator

kendonB commented May 5, 2019

Just thinking about ways to do this

One can fetch using e.g.:

git fetch https://github.com/dictation-toolbox/Caster.git pull/490/head

which puts the new branch into FETCH_HEAD. Then we can check it out as a new branch like:

git checkout -b dictation-toolbox/Caster/pull/490 FETCH_HEAD

Then you're done! So, the process would be (from a PR main page):

  • Ctrl-L to go to the address bar
  • Copy to a python object (The string is of the form: BASEURL/pull/PULLID)
  • Do a string split by /pull/.
  • Open git bash
  • How will it know where your local repo is? SOLVED
  • Take the first element of the string split and do:
git fetch <str_split1>.git pull/<str_split2>/head
  • Do a string replace with <str_split1> replacing "https://github.com/" with ""
  • Then:
git checkout -b <str_split1> FETCH_HEAD
@kendonB
Copy link
Collaborator Author

kendonB commented May 5, 2019

What's the best way to do this within caster? Another function in utilities.py?

@kendonB kendonB changed the title Helper function to checkout a branch on github from the browser Helper function to checkout a branch on github from a web browser May 5, 2019
@kendonB
Copy link
Collaborator Author

kendonB commented May 5, 2019

Perhaps .caster could have a toml matching BASEURL to user folders

@LexiconCode
Copy link
Member

That would be tricky

* How will it know where your local repo is? NEED HELP ON THIS STEP

The install folder for the classic install is the local repo. If I'm understanding your definition of local repo and not the remote.

@LexiconCode LexiconCode added the New Feature A new feature that is not currently implemented. label May 6, 2019
@kendonB
Copy link
Collaborator Author

kendonB commented May 6, 2019

The install folder for the classic install is the local repo. If I'm understanding your definition of local repo and not the remote.

Not sure what you mean by this. To be clear, this feature would work for any github repository for which the user has a local copy. I believe my idea of having a .toml of BASEURLs and user folders would work to link the copied URL to the local folder.

@kendonB
Copy link
Collaborator Author

kendonB commented May 6, 2019

How does one copy a selection to a python object within caster? I want to do something like new_object = navigation.stoosh_keep_clipboard()

@kendonB kendonB added the Help Wanted Seeking co-contributor label May 6, 2019
@kendonB
Copy link
Collaborator Author

kendonB commented May 6, 2019

from alexboche: lib.context.read_selected_without_altering_clipboard

@kendonB
Copy link
Collaborator Author

kendonB commented May 6, 2019

I have made a start but haven't been able to get Key to work to get dragonfly/caster to type "Ctrl-L" to move to the address bar of the browser. How do I do this from within a function? I have it imported using from castervoice.lib.actions import Key and I'm just invoking it using Key("c-l/20").

@kendonB kendonB self-assigned this May 6, 2019
@LexiconCode
Copy link
Member

LexiconCode commented May 6, 2019

You could do
Key("c-l/20").execute()
Or
movebar = Key("c-l/20").execute()
Or
I think...
movebar = Key("c-l/20")
movebar.execute()

See Atom.py for some of this in action. I would link directly but I'm on mobile.

@kendonB
Copy link
Collaborator Author

kendonB commented Jun 5, 2019

This is almost done in #498. Closing here.

@kendonB kendonB closed this as completed Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Seeking co-contributor New Feature A new feature that is not currently implemented.
Projects
None yet
Development

No branches or pull requests

2 participants