+ All Categories
Home > Documents > Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every...

Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every...

Date post: 17-Oct-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
196
Hack Your VCS In Ruby http://www.delicious.com/rauros/amp http://spkr8.com/t/5050
Transcript
Page 1: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Hack Your VCS In Ruby

http://www.delicious.com/rauros/amphttp://spkr8.com/t/5050

Page 2: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Justin Love

[email protected]

http://JustinLove.name

@wondible

Page 3: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

I am a Mercurial

User

Page 4: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

THISshould not matter

Page 5: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

Is Free of religious devotion to one VCS1

Page 6: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 7: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Overview

•What is Amp?

•Why Amp?

•What will Amp do for me?

•How do I use Amp?

•How can I help?

Page 8: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

My VCS Journey

Page 9: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

College1994-1998

VCS

Page 10: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

VSS

Page 11: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

SVN

Page 12: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Interface

git hg

arcane clean2007

Page 13: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Documentation

git hg

2007

Page 14: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Portabillity

git hg

windows ✔

2007

Page 15: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

HG

Page 16: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

github launched: 2008

Page 17: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Justin,Take aDrink

http://www.flickr.com/photos/mtip/4904103330/

Page 18: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

What Is

Page 19: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 20: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

hg

?

.git

.hg

?

Interfaces Repositories

Page 21: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 22: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

hg .hg

Full Mercurial Suppport

Page 23: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 24: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

FlexibleCommandsWritten in

Ruby

Page 25: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Michael ‘adgar’ Edgar

Ari ‘seydar’ Brown

Page 26: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Ari Brown

“Back in the day, someone pointed out that Rails is slang for cocaine. So, obviously, we needed to name it after a drug.”

Page 27: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

RubyOn

Rails?

Page 28: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Ari Brown

“We looked online for nicknames for meth, and chose amp because it was short (3 letters) and wasn't blatantly drug related.”

Page 29: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

How would you make

a VCS?

Page 30: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ amp clone hg amp

Page 31: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Existing Implementation

in a

DynamicLanguage

Page 32: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Mercurial (GPL)

Amp (GPL)

Page 33: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Michael Edgar

“Long story short: Amp kicks ass and you should use it. It's still growing and not bug-free.

If you're on Ruby 1.9, beware of Unicode”

Page 35: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’
Page 36: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

changeset: 661:7dbef9c17c2euser: seydardate: Sun Aug 08 2010summary: updated bug 24's...

Page 37: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ amp pull git$ amp merge

Page 38: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

changeset: 662:c6fb001fb520user: Justin Love date: Tue Aug 17 2010summary: use ruby format...

Page 39: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

RubyConfCFP Close2010-08-30

Page 40: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

A funny thing happened on the way to RubyConf...

Page 41: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

changeset: 661:7dbef9c17c2euser: seydardate: Sun Aug 08 2010summary: updated bug 24's...

Page 42: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

404http://amp.carboni.ca/

Page 43: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

David A. Black2010-09-20

“We're happy to let you know that your proposal, "AMP: Cross-repo version control in Ruby.", has been selected for inclusion in the program.”

Page 44: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

changeset: 661:7dbef9c17c2euser: seydardate: Sun Aug 08 2010summary: updated bug 24's...

Page 45: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

amp-redux?

Page 46: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ amp pull gitrequesting all changesadding changesetsadding manifestsadding file changestransaction abort!interrupted!

Page 47: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Ari Brown

“FUN FACT!

Getting git to play right is much more complicated than whatever that   law is that says everything is super complicated.”

Page 48: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

amp

hg

Page 49: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

amp

hg

git

Page 50: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Ari Brown

“HG focuses on the imp-lementation (filelogs, change-logs, indexes/indices), and we wanted to focus on changesets, repositories, and stuff like that”

Page 51: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Ari Brown

“It's like an old car that needs to get scrapped. It sucks, but holy shit man, it got us hundreds of thousands of miles.”

Page 52: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

We want to discover where the limits are on Ruby for use in large applications. Where is the language slow? Where is it fast? What techniques are effective?

6

Page 53: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Fred BrooksThe Mythical Man-Month

“plan to throw one away; you will, anyhow.”

Page 54: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Redux

Page 55: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Not backed by code

http://claudiamarchan.blogspot.com/2008/08/little-unicorn.html

Page 56: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Michael Edgar

“I'm learning a shitton about software design and engineering which will pay back Amp in spades.”

Page 57: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Interface

Implementation

Page 58: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Modular

Page 59: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

AmpFront

Page 60: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

AmpCore

Page 61: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Amp-hgAmp-git

Page 62: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 63: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Justin,Take aDrink

http://www.flickr.com/photos/mtip/4904103330/

Page 64: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Why

Page 65: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

C

Page 66: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Mercurial

Python

Page 67: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Bazaar

Python

Page 68: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Darcs

Haskell

Page 69: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Monotone

C++

Page 70: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

SVN

C

Page 71: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

SVK

Perl

Page 72: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

C/++ 3Python 2

Perl 1Haskell 1Ruby?

Page 74: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

5 We want to prove ruby is viable for large-scale applications, not just web frameworks. Can you think of any non-trivial actual applications written in ruby?

Page 75: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 76: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Do wereally need

anotherVCS?

Page 77: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

RubyRuby Logo © 2006, Yukihiro Matsumoto

Page 78: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’
Page 79: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’
Page 80: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Rubinius

Page 81: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’
Page 82: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Sinatra

Page 83: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

merb

Page 84: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

3

Page 85: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’
Page 86: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 87: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

VSSSVN

Mercurial

Page 88: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

CVSSVNGit

Page 89: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

1?

Page 90: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

2?

Page 91: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

3?

Page 92: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

> 3?

Page 93: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

There Will Be a

Next Thing

Page 94: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

David Heinemeier Hanssonhttp://news.oreilly.com/2008/08/interview-with-david-heinemeie.html

“If nobody is hating it, you're typically not doing very interesting work."

Page 95: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Justin,Take aDrink

http://www.flickr.com/photos/mtip/4904103330/

Page 96: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

How will

help me?

Page 97: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 98: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Mercurial Repos

Page 99: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’
Page 100: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ amp

Page 101: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

require ‘amp’

Page 102: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

hg

?

.git

.hg

?

Page 103: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git .git

.hg

?

Page 104: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

hg

.git

.hg

Page 105: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

hg

.git

.hg

n2

Page 106: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

hg

?

.git

.hg

?

n+m

Page 107: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ActiveRecord

Rails

?

MySQL

Postgres

?

Page 108: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

?

AWS

BlueBox

?

Page 109: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

.git

.hg

?

Page 110: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Firefox

hg clone http://hg.mozilla.org/...

Page 111: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Adium

hg clone http://hg.adium.im/adium

Page 112: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

VIM

hg clone https://vim.googlecode...

Page 113: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Inkscape

svn co https://inkscape.svn.sour...

Page 114: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

2 Lets us customize how we interact with it. If we want git's commands because I used it the longest, let us use them with a mercurial repo.

Page 115: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

hg

?

.git

Page 116: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Mixand

Match

Page 117: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 118: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

• railties

• actionmailer

• actionpack

• activemodel

• activerecord

• activeresource

• activesupport

Rails 3

Page 119: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Redux

• amp-front

• amp-core

• amp-hg

• amp-git

Page 120: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

hg

?

.git

.hg

Page 121: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

hg

.git

.hg

?

Page 122: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

3 We want the extension we wrote for HG to work on my github project too. Because they're both DVCS, damnit.

Page 123: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

git

hg

?

.git

.hg

?extensions

Page 124: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Justin,Take aDrink

http://www.flickr.com/photos/mtip/4904103330/

Page 125: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

How doI use

Page 126: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ gem install amp

Page 127: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ amp help$ amp add$ amp commit$ amp push

Page 128: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

4 We want to be able to directly modify the commands they give us. Git's remove command is `git rm`. It should be dead simple to make `git remove` map directly to that, and we mean less than 1 minute of thought/work.

Page 129: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 130: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ampfile.rb

Page 131: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Michael Edgar

“One huge feature is open commands: the same syntax for creating a command will re-open an existing one, just like classes in Ruby.”

Page 132: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

DANGERLive Coding

Page 133: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

command :log do |c| c.workflow :hg c.desc "Prints the commit history." c.opt :verbose, "Verbose output", {:short => "-v"} c.opt :limit, "Limit how many revisions to show", {:short => "-l", :type => :integer, :default => -1} c.opt :template, "Which template to use while printing", {:short => "-t", :type => :string, :default => "default"} c.opt :no_output, "Doesn't print output (useful for benchmarking)" c.on_run do |options, args| repo = options[:repository] limit = options[:limit] limit = repo.size if limit == -1

start = repo.size - 1 stop = start - limit + 1

options.merge! :template_type => :log start.downto stop do |x| puts repo[x].to_templated_s(options) unless options[:no_output] end endend

Page 134: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

command :log do |c|

Page 135: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.workflow :hg

Page 136: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.desc "Prints the commit history."

Page 137: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.opt :verbose, "Verbose output", {:short => "-v"}c.opt :limit, "Limit how many revisions to show", {:short => "-l", :type => :integer, :default => -1}c.opt :template, "Which template to use while printing", {:short => "-t", :type => :string, :default => "default"}c.opt :no_output, "Doesn't print output (useful for benchmarking)"

Page 138: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.on_run do |options, args| repo = options[:repository] limit = options[:limit] limit = repo.size if limit == -1

start = repo.size - 1 stop = start - limit + 1

options.merge! :template_type => :log start.downto stop do |x| puts repo[x].to_templated_s(options) unless options[:no_output] end end

Page 139: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.on_run do |options, args| repo = options[:repository] limit = options[:limit] limit = repo.size if limit == -1

start = repo.size - 1 stop = start - limit + 1

options.merge! :template_type => :log start.downto stop do |x| puts repo[x].to_templated_s(options) unless options[:no_output] end end

Page 140: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.on_run do |options, args| repo = options[:repository] limit = options[:limit] limit = repo.size if limit == -1

start = repo.size - 1 stop = start - limit + 1

options.merge! :template_type => :log start.downto stop do |x| puts repo[x].to_templated_s(options) unless options[:no_output] end end

Page 141: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 142: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

User Command:Billing Time

Page 143: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ amp billing --limit 302010-09-21 0.252010-09-02 2.222010-09-01 0.252010-08-31 4.737.46

Page 144: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

DANGERLive Coding

Page 145: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

command :billing do |c| c.desc "Estimate time spent" c.opt :limit, "Limit how many revisions to show", {:short => "-l", :type => :integer} c.opt :rate, "Billing Rate", {:type => :integer} c.on_run do |options, args| # boilerplate repo = options[:repository] limit = options[:limit] || repo.size rate = options[:rate] || 1 last = repo.size - 1 first = last - limit + 1

# calculate time hours = repo.to_a[first,last].each_cons(2).map(&BillingTime.method(:new))

# daily summary days = Hash.new(0) hours.each {|b| days[b.date] += b.billable} puts days.keys.sort.reverse.map {|k| "#{k} #{days[k]}"}

# total bills = hours.map {|b| b.billable * rate} puts bills.inject {|a,b| a + b} endend

Page 146: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

command :billing do |c| c.desc "Estimate time spent"

Page 147: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

...archive Create...billing Estimate...bisect subdivision......

Page 148: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.opt :limit,"Limit how many revisions to show", {:short => "-l", :type => :integer}c.opt :rate, "Billing Rate", {:type => :integer}

Page 149: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ amp help billingEstimate time spent --limit, -l <i>: Limit how many revisions to show --rate, -r <i>: Billing Rate --help, -h: Show this message

Page 150: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

c.on_run do |options, args| # boilerplate repo = options[:repository] limit = options[:limit] || repo.size rate = options[:rate] || 1 last = repo.size - 1 first = last - limit + 1

Page 151: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

# calculate timehours = repo[first..last]. each_cons(2). map(&BillingTime.method(:new))

Page 152: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

# daily summarydays = Hash.new(0)hours.each {|b| days[b.date] += b.billable}puts days.keys.sort.reverse. map {|k| "#{k} #{days[k]}"}

Page 153: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

# totalbills = hours.map {|b| b.billable * rate}puts bills.inject {|a,b| a + b}

Page 154: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 155: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Justin,Take aDrink

http://www.flickr.com/photos/mtip/4904103330/

Page 156: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

How canI help

Page 157: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

7 We want to be an example of proper documentation.

Page 158: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’
Page 159: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

MANIFESTO

Page 160: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

STYLE

Page 161: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

TODO

Page 162: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Amp-front

Page 163: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

OptionParsing

Page 164: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Help

Page 165: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Trollop

Page 166: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

command==

class

Page 167: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Plugins

Page 168: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Amp-core

Page 169: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

VersionControl

Page 170: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

GenericRepository

Page 171: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Amp-hg

Page 172: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

GPL

Page 173: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Amp-git

Page 174: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

MultipleBackends

?

Page 175: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Command line

wrapper

Page 176: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Michael Edgar

“[...] parsing the output of various commands turned into hell, because almost none of the output is standardized.”

Page 177: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Amp-grit?

Page 178: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Pure Ruby

Page 179: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Amp-ribbit?libgit2

Page 180: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Justin,Take aDrink

http://www.flickr.com/photos/mtip/4904103330/

Page 181: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Review

Page 182: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 183: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

$ gem install amp

Page 184: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

Is Free of religious devotion to one VCS1

Page 185: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

2 Lets us customize how we interact with it. If we want git's commands because I used it the longest, let us use them with a mercurial repo.

Page 186: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

3 We want the extension we wrote for HG to work on my github project too. Because they're both DVCS, damnit.

Page 187: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

4 We want to be able to directly modify the commands they give us. Git's remove command is `git rm`. It should be dead simple to make `git remove` map directly to that, and we mean less than 1 minute of thought/work.

Page 188: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

5 We want to prove ruby is viable for large-scale applications, not just web frameworks. Can you think of any non-trivial actual applications written in ruby?

Page 189: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

We want to discover where the limits are on Ruby for use in large applications. Where is the language slow? Where is it fast? What techniques are effective?

6

Page 190: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

ManifestoWe want a piece of software that:

7 We want to be an example of proper documentation.

Page 191: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

IsA familiar, customizable

interface to every version control repository.

Page 192: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

These are our goals

Page 193: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Ruby

Ruby Logo © 2006, Yukihiro Matsumoto

These are our tools RSpec

Page 194: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Now is the

time.

Page 195: Hack Your VCS In Ruby · Full Mercurial Suppport. Is A familiar, customizable interface to every version control repository. Flexible Commands Written in Ruby. Michael ‘adgar’

Recommended