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

Support '--branch' #4

Open
bubenkoff opened this issue Jun 15, 2013 · 8 comments
Open

Support '--branch' #4

bubenkoff opened this issue Jun 15, 2013 · 8 comments

Comments

@bubenkoff
Copy link

Hi

In my experience branches are more useful than snapshots.

http://pastebin.com/dt0tmj1M

During the development, usually people use branches, but snapshots are like commits,
which makes snapshot list so not so nice looking. Example

Can you implement branch-like snapshoting? where you can move between branches, and commit inside of them?
Sorry im not good at drawing, hope it's clear

@bubenkoff
Copy link
Author

yes sorry missed that i've already added an issue earlier :)

@bubenkoff
Copy link
Author

what do you think of it in general?

@dergachev
Copy link
Owner

Well, I probably won't have time to implement this, but it's an interesting idea for someone to pick up.

First, it seems that the notion of consistent branch names (eg having MASTER or FEATURE always point to the latest in a branch) is separate from the idea of automatically cleaning up intermediate snapshots.

Deleting snapshots in virtualbox seems hopelessly slow, and I've even seen recommendations to clone a running VM and deleting the old one, in preference to deleting the snapshots one at a time. If that's important to you, perhaps you can make a base Vagrant box and then have multiple Vagrant projects, one for each branch?

As for the branch names idea, perhaps it could be implemented with the following:

vagrant snapshot take base
# create snapshot named base

vagrant snapshot take --branch master
# creates snapshot named master_123, where 123 is a timestamp

vagrant snapshot take
# creates snapshot master_124, where 124 is a timestamp

vagrant snapshot go base
# restores to snapshot base

vagrant snapshot take --branch featureOne
# creates snapshot featureOne_125, where 125 is a timestamp

vagrant snapshot go --branch master
# restores to snapshot master_124, since that is the latest snapshot matching master branch.

Thoughts?

@bubenkoff
Copy link
Author

How about

$ vagrant snapshot branch

shows list of branches with current one marked

$ vagrant snapshot branch

take snapshot marking it as new branch

$ vagrant snapshot commit

take snapshot under current branch

$ vagrant snapshot checkout

back to latest snapshot in current branch

$ vagrant snapshot checkout

go to latest snapshot in given branch

On 3 Sep 2013 21:40, "Alex Dergachev" notifications@github.com wrote:

Well, I probably won't have time to implement this, but it's an
interesting idea for someone to pick up.

First, it seems that the notion of consistent branch names (eg having
MASTER or FEATURE always point to the latest in a branch) is separate from
the idea of automatically cleaning up intermediate snapshots.

Deleting snapshots in virtualbox seems hopelessly slow, and I've even seen
recommendations to clone a running VM and deleting the old one, in
preference to deleting the snapshots one at a time. If that's important to
you, perhaps you can make a base Vagrant box and then have multiple Vagrant
projects, one for each branch?

As for the branch names idea, perhaps it could be implemented with the
following:

vagrant snapshot take base

create snapshot named base

vagrant snapshot take --branch master

creates snapshot named master_123, where 123 is a timestamp

vagrant snapshot take

creates snapshot master_124, where 124 is a timestamp

vagrant snapshot go base

restores to snapshot base

vagrant snapshot take --branch featureOne

creates snapshot featureOne_125, where 125 is a timestamp

vagrant snapshot go --branch master

restores to snapshot master_124, since that is the latest snapshot matching master branch.

Thoughts?


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-23740803
.

This was referenced Sep 4, 2013
@dergachev
Copy link
Owner

Though I see the appeal of git nomenclature, it would have to be implemented in a separate plugin, since vagrant-vbox-snapshot is meant to be a thin wrapper on VBoxManage snapshot CLI.

Assuming we're keeping snapshot take and snapshot go (which should be called restore), we would have the following redundancies:

To minimally modify the the current CLI with branch support:

$ vagrant snapshot take
# take snapshot with auto-generated name 
# eg <last>_1234, where <last> would be the last snapshot name with with trailing timestamp removed

$ vagrant snapshot take <snapshot>
# create snapshot with name <snapshot>

$ vagrant snapshot take --branchb <branch>
# create snapshot with name <branch>_1234, where 1234 is a timestamp

$ vagrant snapshot take
# take snapshot with auto-generated name 
# eg <last>_1234, where <last> would be the last snapshot name with with trailing timestamp removed

$ vagrant snapshot list
# shows list of snapshots; already minimally branch aware, since snapshot name contains branch name

$ vagrant snapshot go
# restore latest snapshot (currently implemented via `vagrant snapshot back`)

$ vagrant snapshot go <snapshot>
# restore snapshot with name exactly matching <snapshot>

$ vagrant snapshot go --branch <branch>
# restore the latest snapshot with branch name matching <branch>

For a first stab, here's what we'd have to implement:

Relatedly, we might also implement:

  • rename vagrant snapshot take to vagrant snapshot restore
  • improve formatting of vagrant snapshot list, to highlight branch names
  • include datetime in list command #7 - include date in vagrant snapshot list

Thoughts? Care to take a stab?

@bubenkoff
Copy link
Author

yes ideally i would like to see git-like everything :)
but as long as you don't want to add complexity... i see your point and
agree
in terms of help, i don't know ruby so good, but probably will try
something to implement, but looks like for branching everything is
dependent on #9

On 4 September 2013 17:55, Alex Dergachev notifications@github.com wrote:

Though I see the appeal of git nomenclature, it would have to be
implemented in a separate plugin, since vagrant-vbox-snapshot is meant to
be a thin wrapper on VBoxManage snapshot CLIhttp://www.virtualbox.org/manual/ch08.html#idp14525104.

Assuming we're keeping snapshot take and snapshot go (which should be
called restore), we would have the following redundancies:

To minimally modify the the current CLI with branch support:

$ vagrant snapshot take

take snapshot with auto-generated name

eg _1234, where would be the last snapshot name with with trailing timestamp removed

$ vagrant snapshot take

create snapshot with name

$ vagrant snapshot take --branchb

create snapshot with name _1234, where 1234 is a timestamp

$ vagrant snapshot take

take snapshot with auto-generated name

eg _1234, where would be the last snapshot name with with trailing timestamp removed

$ vagrant snapshot list

shows list of snapshots; already minimally branch aware, since snapshot name contains branch name

$ vagrant snapshot go

restore latest snapshot (currently implemented via vagrant snapshot back)

$ vagrant snapshot go

restore snapshot with name exactly matching

$ vagrant snapshot go --branch

restore the latest snapshot with branch name matching

For a first stab, here's what we'd have to implement:

Relatedly, we might also implement:

Thoughts? Care to take a stab?


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-23800893
.

Anatoly Bubenkov

@dergachev
Copy link
Owner

Yep, I guess #9 would make a good first step if you wanted to try and contribute. :)

Alex Dergachev
Evolving Web, co-founder and lead developer
http://evolvingweb.ca :: web design & development
phone 514.844.4930 :: fax 514.807.7499
114-300 rue du Saint-Sacrement, Montréal, QC
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Wednesday, 4 September, 2013 at 12:24 PM, Anatoly Bubenkov wrote:

yes ideally i would like to see git-like everything :)
but as long as you don't want to add complexity... i see your point and
agree
in terms of help, i don't know ruby so good, but probably will try
something to implement, but looks like for branching everything is
dependent on #9

On 4 September 2013 17:55, Alex Dergachev <notifications@github.com (mailto:notifications@github.com)> wrote:

Though I see the appeal of git nomenclature, it would have to be
implemented in a separate plugin, since vagrant-vbox-snapshot is meant to
be a thin wrapper on VBoxManage snapshot CLIhttp://www.virtualbox.org/manual/ch08.html#idp14525104.

Assuming we're keeping snapshot take and snapshot go (which should be
called restore), we would have the following redundancies:

To minimally modify the the current CLI with branch support:

$ vagrant snapshot take

take snapshot with auto-generated name

eg _1234, where would be the last snapshot name with with trailing timestamp removed

$ vagrant snapshot take

create snapshot with name

$ vagrant snapshot take --branchb

create snapshot with name _1234, where 1234 is a timestamp

$ vagrant snapshot take

take snapshot with auto-generated name

eg _1234, where would be the last snapshot name with with trailing timestamp removed

$ vagrant snapshot list

shows list of snapshots; already minimally branch aware, since snapshot name contains branch name

$ vagrant snapshot go

restore latest snapshot (currently implemented via vagrant snapshot back)

$ vagrant snapshot go

restore snapshot with name exactly matching

$ vagrant snapshot go --branch

restore the latest snapshot with branch name matching

For a first stab, here's what we'd have to implement:

Relatedly, we might also implement:

Thoughts? Care to take a stab?


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-23800893
.

Anatoly Bubenkov


Reply to this email directly or view it on GitHub (#4 (comment)).

@bubenkoff
Copy link
Author

i have another KISS idea :)
what if when you GO to some snapshot, plugin will always select the latest snapshot with same name (for now it selects some 'random' one i think)
so basically this will only require knowledge of datetime of snapshots!

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

No branches or pull requests

2 participants