cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

PrototypesRepo

Proposal for a Mercurial repository named http://hg.netbeans.org/prototypes/ to serve as an area for publicly visible prototypes which may or may not ever be merged into the official main* repository family. Each prototype lives on its own named branch.

Technical setup:

  • a clone initially of main-silver
  • broad push permissions (anyone with main* push access)
  • does not run forbid_2head.py hook, or runs modified version which forbids >1 head to share a single branch name
  • does run special hook forbidding changesets on default branch unless authenticated push username is ffjre
  • push-to-prototypes job pushes new main-silver changesets on a regular basis

Usage:

  • pick a short but descriptive branch name, preferably including Issuezilla reference number, e.g. faster-editor-123456
  • make a clone and commit some stuff to your branch:
  hg clone main-silver prototypes
  cd prototypes
  # edit .hg/hgrc to set default to http://hg.netbeans.org/prototypes/
  # and set default-push to https://yourname:***@hg.netbeans.org/prototypes/
  hg branch faster-editor-123456
  # edit some editor sources or whatever
  hg ci -m 'Playing with #123456: faster editor'
  hg push
  
  • (optionally) set up a Hudson job somewhere; just use http://hg.netbeans.org/prototypes/ as the repository and put faster-editor-123456 in the Branch field
  • work on changes as long as you like:
  # synch with trunk:
  hg pull
  # if anything came in:
  hg merge default
  hg ci -m 'merged default into faster-editor-123456'
  # edit more
  hg ci -m '#123456 cont'd: even faster editor'
  hg push
  
  • if you ever wish to merge your branch into the official trunk:
  cd my-team-main
  hg fetch
  hg pull -r faster-editor-123456 ../prototypes
  hg merge faster-editor-123456
  hg ci -m 'merged #123456'
  hg out -pv
  hg push
  
  • resume new experimental work on a branch that has already been closed:
  cd prototypes
  hg up -C faster-editor-123456
  # edit, commit, and push more as before
  
  • start a new branch (no problem to have several open at once):
  cd prototypes
  hg pull
  hg up -C default
  hg branch prettier-editor-135791
  # edit, commit, push
  
  • switch between open branches:
  cd prototypes
  hg up -C other-branch-128976
  # edit, commit, push
  
  • collaborate with another developer on a branch:
  cd prototypes
  hg up -C complicated-branch-188833
  hg fetch -r complicated-branch-188833
  # work normally
  

Patch Branches also works well with this style, as a partial replacement for MQ:

# start a patch:
hg up default
hg pnew -t 'Issue #123456: faster editor.' faster-editor-123456
# edit, commit, push as usual
# to synch with trunk:
hg pull
hg pmerge
# to switch to trunk or another branch:
hg up default
hg up prettier-editor-135791
# to finish: (pending http://bitbucket.org/parren/hg-pbranch/issue/30/hg-pfinish)
hg up faster-editor-123456
hg pdiff > /tmp/faster-editor-123456.diff
cd ../team-repo
hg import /tmp/faster-editor-123456.diff
hg push
# ...and probably also want to close branch:
cd ../prototypes
hg ci -m 'done' --close-branch

See also HgPerDeveloperBranch for other usages of named branches.