Moving the Ant.tmbundle
February 10th, 2010
Initially I set out with the aim to switch from Subversion to Git before there was an official plan from the TextMate crew. This has now changed, and all bundles that show Github activity are being removed from the TextMate svn repository. Which means that the official bundles I mirrored now have a duplicate Github mirror, and one that is more central for TextMate users and should be the root of all development. The Apache bundle was easy to sort, as there were no forks I could simply delete my copy. The Ant bundle wasn’t so straightforward.
Theoretically there’s no reason why two mirrored repositories couldn’t be used as each can be
added as a remote. But because of their independent initialisation against the
svn repo their histories aren’t identical this doesn’t work correctly in practice. Even though the file contents are identical at each commit git still recognises separate commits because git-svn appends unique metadata. So you end up with a lot of messy duplication in the history tree.
The fastest solution is to rebase one mirror into the other. Public rebasing
isn’t the done thing as it’s bad practice to be changing the repository history
when others could be working against it. However in this case we are looking to
retire one history completely. I think, given that there’s only a little work
in the forks, and the file content is the same it is the right solution.
So here are the steps I took to merge my mirror into the official one
- Forked and cloned the official bundle on github
cd‘d to the root of the clone- Added new remote using
git remote add old-origin git@github.com:simongregory/ant-tmbundle.git - Fetch the remote data
git fetch old-origin - Created old-master branch from the old-origin/master with
git br old-master old-origin/master - Checked out old-master
git co old-master - Rebased old-master onto master using
git rebase master - Switched back to master
git co master - Merged master with old-master
git merge old-master - Deleted the old-master branch
git br -D old-master - Created new sg branch
git co -b sg - Cherry picked the one commit I needed
git cherry-pick 91f598 - Pushed the branch
git push origin sg - Removed the old-origin remote using
git remote rm old-origin
Then to linked to the official TextMate remote using
- git remote add tm git@github.com:textmate/ant.tmbundle.git
- Fetched the remote data
git fetch tm - Checked master out
git co master - Synced master branches by pushing
git push tm(only possible if you have write access)
One extra thing to note is the change from the old naming convention using a hyphen to a period.
There’s likely to be a better way of achieving this, but this is what worked for me. It won’t work if you have any private branches as you wouldn’t be able to pull them across. In this case I’d look at inverting the process and adding the new fork as a remote to the existing repository and merging from there.
Improved Auto Import for ActionScript 3 in TextMate
February 18th, 2009
The ActionScript 3 bundles had the ability to auto import a class for a long time, but the functionality has been limited to the area of the document between the package and class declarations. There have been some interesting solutions to improve this workflow, but ultimately it needed a more elegant solution.
If you grab the most recent version of the bundle you’ll now find that ⇧⌘I can be invoked from a wider scope and will present you with a list of possible classes to import based on the current word. Select one and an import statement for the class will be generated and injected into the document (or a tooltip saying the class is already imported).
I ought to stress that the importing is improved, but needs more work. The command is scoped to work within a public class, so any private classes hiding beneath your package block won’t benefit. You’re also likely, if you’re tidy, to want to organise the imports statements later on. But what is great about this is it let’s you skip a repetitive task and focus on higher level logic.