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

Teach BranchUpdater to set merge branch directly #353

Closed
wants to merge 1 commit into from

Conversation

jamill
Copy link
Member

@jamill jamill commented Feb 25, 2013

This PR lets us set the upstream remote and merge branch onto a local branch directly.

This is useful when we are pushing a new local branch to a remote and want to set the upstream tracking info. Instead of performing the refspec transform to identify the name of the tracked branch in the refs/remotes namespace, we can set the merge branch directly (e.g., using the transforms exposed in #349)


Branch upstreamBranch = repo.Branches[upstreamBranchName];
Branch updatedBranch = repo.Branches.Update(branch,
b => b.SetUpstreamTo(upstreamRemoteName, mergeBranchName));
Copy link
Member

Choose a reason for hiding this comment

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

Instead of exposing a method, how about exposing two properties (maybe RemoteName and MergeBranchName)?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm... and pass each one seperately through the branch updater? we could do it that way.

Copy link
Member

Choose a reason for hiding this comment

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

You could define SetUpstreamTo() as an extension method for convenience, but expose all the possible mutations for BranchUpdater as properties.

Copy link
Member

Choose a reason for hiding this comment

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

You could define SetUpstreamTo() as an extension method for convenience

Actually, I'd rather not. At least, for now.

I'd like to try and settle a property based access only for xxxUpdaters in order to see how far we can stretch this out while keeping it usable. Adding methods in the mix may blur the picture a little bit.

@jamill
Copy link
Member Author

jamill commented Mar 15, 2013

Updated - I added two properties UpstreamRemote and UpstreamMergeBranch - I could change these to @nulltoken 's proposed names RemoteName and MergeBranchName if people feel that is more appropriate.

@nulltoken
Copy link
Member

Updated - I added two properties UpstreamRemote and UpstreamMergeBranch

Perfect! And... merged 💥

@nulltoken nulltoken closed this Mar 17, 2013
@jamill
Copy link
Member Author

jamill commented Mar 18, 2013

@nulltoken Thanks!

@jamill jamill deleted the branch_updater branch March 18, 2013 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants