Diff for "Code/UploadingABranch"

Not logged in - Log In / Register

Differences between revisions 11 and 21 (spanning 10 versions)
Revision 11 as of 2008-10-10 11:05:34
Size: 4920
Comment:
Revision 21 as of 2009-12-29 06:37:05
Size: 2824
Editor: kralph
Comment: grammar, wording
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
'''DRAFT: this page is a work in progress. Please [[Feedback|seek further help]] or check the [[TitleIndex|wiki index]] for a complete page on this topic.''' ## page was renamed from Code/UploadingABranch/Draft
~-[[FrontPage|Launchpad Help]] > [[Code]] > Uploading a branch -~
Line 13: Line 14:
The easiest way to get your code on Launchpad is to push your branch using Bazaar. Alternatively, Launchpad can mirror a Bazaar branch that's hosted elsewhere on the internet or convert existing Subversion and CVS repositories into Bazaar branches. The easiest way to get your code on Launchpad is to push your branch using Bazaar. Alternatively, Launchpad can mirror a Bazaar branch that's hosted elsewhere on the internet or convert existing git, Subversion and CVS repositories into Bazaar branches.
Line 17: Line 18:
<<Anchor(registering)>>
== Registering your branch in Launchpad ==
If you've already got a Bazaar branch on your local machine, getting that branch up to Launchpad couldn't be easier.
Line 20: Line 20:
First up, tell Launchpad about your branch. Visit [[https://code.launchpad.net/people/+me/+addbranch|your branch registration page]] and follow the on-screen instructions.

'''Note:''' if you haven't already, you should read our guide to [[Code/FindingAndDownloading|creating your own branch]].

You should leave most of the options on the branch registration page at their default setting, other than:

 * '''Project:''' choose whichever project your code is a branch of
 * '''Branch type:''' choose ''Hosted'' as you want to host your branch on Launchpad.

Once you've clicked the ''Register branch'' button, you're ready to push your code up to Launchpad.

'''Tip:''' you can also push your branch to Launchpad without first registering it. To do so, you need to use the ''lp:~your-username/project-name/branch-name'' format. For your first branch, you should probably follow this guide.


<<Anchor(first-push)>>
== Making the first push ==

||<tablestyle="float:right; font-size: 0.8em; width:30%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">{{attachment:branch-update.png}}||

Before you do anything else, you need to tell Launchpad who you are and then ask Bazaar to log into Launchpad using your account. If you haven't already, [[ourAccount/CreatingAnSSHKeyPair|register your SSH key with Launchpad]]. Next, open up a terminal and enter:
In your terminal, go to the branch directory and type:
Line 42: Line 23:
$ bzr launchpad-login your-id bzr launchpad-login userid
bzr push lp:~userid/project-name/branch-name
Line 45: Line 27:
Replace ```your-id``` with the unique portion of your Launchpad profile page's URLd - e.g. ''matthew.revell'' - rather than your email address. Replace ''userid'' with your Launchpad id, ''project-name'' with the project's Launchpad id and then chose whichever branch name you want.
Line 47: Line 29:
If your login is successful, Bazaar will give you no message. '''Tip:''' If you have multiple ssh keys, you need to tell Launchpad which key to use.
Line 49: Line 31:
Now, copy the ''Update this branch:'' command from your branch's overview page and paste it in your terminal. Before hit ''Enter'', add ``--use-existing-dir`` to the command, so it looks something like this: Edit your ~/.ssh/config file (if one doesn't exist simply create a new one) and add the following:
Line 52: Line 34:
$ bzr push lp:~your-username/project-name/branch-name --use-existing-dir Host bazaar.launchpad.net
    IdentityFile ~/.ssh/your_launchpad_key
    User your-launchpad-user-name
Line 55: Line 40:
'''Note:''' You only need to add ``use-existing-dir`` the first time that you push to a branch that you've first registered in the UI. [[Code/UploadingABranch#pushing-without-registering|See below for details on pushing a branch without first registering it]]. Bazaar will now push your branch up to Launchpad. You can then view the branch on your own [[https://code.launchpad.net/people/+me|Launchpad branches page]] and also on the project's branches page.
Line 57: Line 42:
Bazaar will now push your branch up to Launchpad. Give it a minute or two, then refresh your branch's overview page and you'll see the branch's most recent commits, as well as information about the format of your branch.

Your branch is now public: anyone can make their own copy, work on that copy on their local machine and, if they choose, push their new branch back up to Launchpad.

<<Anchor(pushing-without-registering)>>
=== Pushing without first registering ===

Once you're more familiar with hosting your Bazaar branches on Launchpad, you can save time by pushing branches up without first registering them in the UI. All you need is to first work out what the branch address should be.

For example:

{{{
$ bzr push lp:~matthew.revell/bzr/bzr-experimental-docs
}}}

Launchpad will see that you're pushing a new branch and register it for your automatically.
Line 76: Line 45:
Now, when you work on your code, all you need to do is commit changes to your local branch using ``bzr commit -m "Commit message"``.  Now, when you work on your code, all you need to do is commit changes to your local branch using ``bzr commit -m "Commit message"``.
Line 84: Line 53:
Setting up a branch mirror is similar to registering a hosted branch, except you supply the URL to your branch and Launchpad make regular copies. Setting up a branch mirror is similar to registering a hosted branch, except you supply the URL to your branch and Launchpad makes periodic copies.
Line 89: Line 58:

||<tablestyle="width: 100%;"> ~-[[Code/FindingAndDownloading|< Finding and downloading code]] -~ ||<style="text-align: right;"> ~- [[Code/TeamBranches|Team branches >]] -~ ||

Launchpad Help > Code > Uploading a branch

Overview

Just as it's easy to create your own Bazaar branch of code that's registered in Launchpad, you can also host your code on Launchpad. It's free and means that your code is:

  • available for anyone else to download and work with
  • publicly associated with the project it relates to
  • ready to take part in public merge requests and code review.

The easiest way to get your code on Launchpad is to push your branch using Bazaar. Alternatively, Launchpad can mirror a Bazaar branch that's hosted elsewhere on the internet or convert existing git, Subversion and CVS repositories into Bazaar branches.

Pushing your Bazaar branch to Launchpad

If you've already got a Bazaar branch on your local machine, getting that branch up to Launchpad couldn't be easier.

In your terminal, go to the branch directory and type:

bzr launchpad-login userid
bzr push lp:~userid/project-name/branch-name

Replace userid with your Launchpad id, project-name with the project's Launchpad id and then chose whichever branch name you want.

Tip: If you have multiple ssh keys, you need to tell Launchpad which key to use.

Edit your ~/.ssh/config file (if one doesn't exist simply create a new one) and add the following:

Host bazaar.launchpad.net
    IdentityFile ~/.ssh/your_launchpad_key
    User your-launchpad-user-name

Bazaar will now push your branch up to Launchpad. You can then view the branch on your own Launchpad branches page and also on the project's branches page.

Pushing subsequent changes to Launchpad

Now, when you work on your code, all you need to do is commit changes to your local branch using bzr commit -m "Commit message".

You only need to push your changes up to Launchpad when you want to make them public.

Mirroring a branch that's hosted elsewhere

If you prefer to host your branch elsewhere, but still want to make it available in Launchpad, you can ask Launchpad to mirror it.

Setting up a branch mirror is similar to registering a hosted branch, except you supply the URL to your branch and Launchpad makes periodic copies.

Next steps

If you need to work on the same branch of code with a group of people, you can create a team branch.

< Finding and downloading code

Team branches >

Code/UploadingABranch (last edited 2016-04-30 09:51:08 by cjwatson)