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

clone subcommand #10

Merged
merged 22 commits into from
Apr 16, 2021
Merged

clone subcommand #10

merged 22 commits into from
Apr 16, 2021

Conversation

rnorth
Copy link
Collaborator

@rnorth rnorth commented Apr 8, 2021

  • Implement turbolift clone using gh and git. Not using git worktrees for simplicity (the space saving probably isn't worth it, especially at this stage).
  • Refactor testing for improved reuse of common setup code, and reverting to standard named-funcs-as-test-methods because we no longer have 'before each'-style setup outside of the test methods.

Resolves #2

}

c.Printf("Creating branch %s in %s/%s\n", dir.Name, parentPath, repo.RepoName)
err = exec.Execute(c, workingCopyPath, "git", "checkout", "-b", dir.Name)
Copy link
Collaborator Author

@rnorth rnorth Apr 8, 2021

Choose a reason for hiding this comment

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

We should use go-git in the medium term; git is used for parity and ease of testing (using same infra as the testing for execution of gh)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Raised #13 to track explicitly

@rnorth rnorth marked this pull request as ready for review April 9, 2021 07:57
@rnorth rnorth changed the title WIP draft implementation of clone Implementationturbolift clone Apr 9, 2021
@rnorth rnorth changed the title Implementationturbolift clone Implementturbolift clone Apr 9, 2021
@rnorth rnorth mentioned this pull request Apr 9, 2021
So that future refactoring away from using CLI binaries is easier.
dir, _ := os.Getwd()
dirBasename := path.Base(dir)

file, err := os.Open("repos.txt")
Copy link
Contributor

Choose a reason for hiding this comment

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

For this I suggest something a bit more structured, like yaml.
It would then be trivial to unmarshall it, instead of the scanner and parsing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is something I'd like to push back on; having it be text based makes it really easy to generate from a variety of tools.

My worry with using a structured file format for this list is that it'd force people to write a program or do some clever text munging to generate the input.

Perhaps an option to consider later might be to have YAML input in addition, depending on whether a repos.yaml or repos.txt file is present.

For what it's worth, I'd consider the entire campaign directory to be its own kind of structured format: we have a file which just contains a list of repos and a file which just contains the PR title/description in markdown format. Both of those could be combined into a single structured file, but I think that having them separated optimizes for each of input/editing.

Copy link
Contributor

@sledigabel sledigabel left a comment

Choose a reason for hiding this comment

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

LGTM; first implementation of clone

@rnorth
Copy link
Collaborator Author

rnorth commented Apr 16, 2021

Thanks @sledigabel

@rnorth rnorth merged commit 3249fc6 into main Apr 16, 2021
@rnorth rnorth deleted the clone branch April 16, 2021 10:33
@rnorth rnorth added the feature label Apr 16, 2021
@rnorth rnorth changed the title Implementturbolift clone clone subcommand Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement turbolift clone
3 participants