PDA

View Full Version : New behavior for Auto-save, versions, and "save state" [Guide]




mrblack927
Mar 1, 2011, 10:20 AM
Hi all,

I've been playing with Lion for a while now and I think I've finally figured out exactly how this new file management philosophy works with Lion. Forgive me if some of this has been posted before. I just wanted to get it all in a concise guide of sorts.

So, first of all, it should be noted that this functionality appears to be implemented via new API calls. That means that developers will have to update their apps to support it. Obviously right now the only apps that could do that are Apple apps. For this demonstration I will be using TextEdit, which appears to have everything built in already.

Here we go...

Open a new TextEdit file
Nothing new here, the app starts and you can start writing.

http://i.imgur.com/cO44I.png

Quit TextEdit without saving (cmd+Q)
Here's where things get weird. You would expect it to prompt you to save the file, or at least store it somewhere with Versions. But it doesn't, it just quits. Where does your file go?

Open TextEdit again
Answer: It didn't go anywhere. When you open the app again, your file is still there as if nothing changed.

http://i.imgur.com/cO44I.png

Even though the app was completely terminated and removed from memory, the "state" was saved. This is similar to iOS multitasking. So how do we close out this file and get rid of it? Well, it seems this is now the responsibility of the window, not the app.

Close the TextEdit window (cmd+W)
Now the app prompts you to save the file. If you choose no, the file will be trashed, otherwise, it will be saved as the name you give it. After that, you can quit the app and it will be in a "new state" the next time you open it.

http://i.imgur.com/3TeJy.png

Open the saved file
The file opens as normal, but now you have a little arrow in the top right corner.

http://i.imgur.com/t0gsy.png

This is for Versions. You can lock, revert, or compare versions by clicking on this arrow. If you lock the file, it will be in read-only mode. Versions will stop taking snapshots and any changes you make will have to either be unlocked or copied to a new file.

http://i.imgur.com/tm7IU.png

Editing a saved file
The neat thing about versions is that after you save it the first time (ie. give it a file name) all future saves are handled by OSX and stored with Versions. For example, textedit knows that you edited the file:

http://i.imgur.com/X4Kvb.png

And when you close the window (cmd+W) it will be automatically saved as a new "version". There is no prompt, and no need for user input. The next time you open the file, it will show you the latest version. If you want to see an older version, you can just click "browse all versions".

http://i.imgur.com/rykZZ.png

Reverting files
The Versions browser is similar to the Time Machine interface. It's a little unpolished right now (no animations), but of course this is just the first beta. Functionally, it is all there. You can "go back in time" to see older copies and even copy and paste text from a saved version to the current copy. Or revert entirely.

Click to see full screen pic of Versions (http://i.imgur.com/Pomyu.jpg)

So what have we learned?
Well, some things have been considerably moved around, but all previous functionality seems to still be there, and much of it has been improved. Most notably, a lot of people have been worried that "quitting will not restore an app to a clean slate". Well, that's true, but closing all windows and then quitting will. Apple seems to be moving towards more per-window management instead of per-app. Cmd+W carries more weight now.

Edit: Also...
It turns out that you don't need to quit anymore! If you close all open windows, the app will automatically quit itself as soon as you move on to something else. For example, clicking on the Safari window causes TextEdit to quit, as long as there are no TextEdit windows open. Neat!

This is basically our first look at a new productivity paradigm. You will be able to quit all of your apps (or even restart) without fear of loosing anything. You will be able to edit things without constantly resaving. Like most things it will take some getting used to but overall it seems like a step in the right direction.

Shoot away with questions if you have any.



zorinlynx
Mar 1, 2011, 10:29 AM
How does the OS handle versions on a filesystem level? Does it store the version information in the resource fork (metadata) or does it store it somewhere else?

If you're working on a file stored on a network volume on a non-Macintosh system (linux fileserver with samba for instance) does versioning still work? Does it depend on the Apple double (._) resource forks to store the data?

I'm the sort of user who had to know how everything works. So my curiosity is on fire here!

mrblack927
Mar 1, 2011, 10:42 AM
How does the OS handle versions on a filesystem level? Does it store the version information in the resource fork (metadata) or does it store it somewhere else?

If you're working on a file stored on a network volume on a non-Macintosh system (linux fileserver with samba for instance) does versioning still work? Does it depend on the Apple double (._) resource forks to store the data?

I'm the sort of user who had to know how everything works. So my curiosity is on fire here!

Good questions. The Versions appear to be stored in a special new volume called "MobileBackups", located at /Volumes/MobileBackups. It appears to use the Time Machine subsystem to handle this which is a per-disk process so I would assume off-disk resources (such as network files) are unsupported, though I have not tested this yet. See the attached pic for a look at the MobileBackups volume. Every one of those folders contains the entire folder structure for your primary disk (in my case "SSD"). Obviously it can't back up the entire disk every hour, so I'm assuming it does a differential backup, maybe even using a special kind of symbolic link for files that haven't changed. The MobileBackups volume is kind of a mystery right now though. The file system sees it as having 0 MB free and taking up an unknown amount of space. It seems Apple is doing some magic behind the scenes there. You'd have to ask someone more well-versed in filesystem structures than me exactly what is going on.

jeznav
Mar 1, 2011, 12:25 PM
I can also add that the system is doing delta backups. It could be that Time Machine also handles
Versions.

There's a command line described in devforums that gives more information on how it works: https://devforums.apple.com/message/388178

kuwisdelu
Mar 1, 2011, 12:59 PM
It turns out that you don't need to quit anymore! If you close all open windows, the app will automatically quit itself as soon as you move on to something else. For example, clicking on the Safari window causes TextEdit to quit, as long as there are no TextEdit windows open. Neat!

Don't think I like that...

hellomoto4
Mar 1, 2011, 07:42 PM
Is Autosave/Versions implemented into Pages? I can't seem to find it.

Cougarcat
Mar 1, 2011, 07:49 PM
Is Autosave/Versions implemented into Pages? I can't seem to find it.

No, it'll require an update.

tourada
Mar 1, 2011, 07:50 PM
Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148a Safari/6533.18.5)

Pages is still from '09. It has to be updated to allow for versions or any other lion feature (like fullscreen). My bet is iWork will get an update come summer

Cougarcat
Mar 1, 2011, 08:04 PM
My bet is iWork will get an update come summer

...or tomorrow? iWork '11, compatible with iPhone, OS X, and iPad?

/dreaming

hellomoto4
Mar 1, 2011, 08:08 PM
Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148a Safari/6533.18.5)

Pages is still from '09. It has to be updated to allow for versions or any other lion feature (like fullscreen). My bet is iWork will get an update come summer

I thought that might've been the case.

As cougarcat said, it would be awesome to see it tomorrow </wishfulthinking>

kuwisdelu
Mar 1, 2011, 08:28 PM
A few questions, if anyone has answers:

Does Lion offer any finer control over how long between Auto-saves/Versions? For some documents, an hour can be a long time between saves...

Is there anyway to force a new save/version any time I want? If there's a big change I want to make, can I force an version snapshot before I make it, and then another after I make it?

Also, if I leave a file open for a long time without making changes to it, will I end up with a bunch of different versions? Or is it smart enough not to create a new version if it sees there's been no changes?

If anyone knows these or takes the time to find out, thanks!

Steve Ballmer
Mar 1, 2011, 08:28 PM
Ideally, by the time Lion hits GM, we'll have iWork '11 and a 64-bit Cocoa iTunes.

And thanks for this guide, I get how Versions works but it's still a bit awkward, only because I'm so used to saving every five minutes. But I'll get used to it.

Cougarcat
Mar 1, 2011, 08:33 PM
A few questions, if anyone has answers:

Does Lion offer any finer control over how long between Auto-saves/Versions? For some documents, an hour can be a long time between saves...

Is there anyway to force a new save/version any time I want? If there's a big change I want to make, can I force an version snapshot before I make it, and then another after I make it?

You can't control how frequently it autosaves, but any time you save normally it creates a snapshot. So yes, if you are going to make a big change, Apple-S before and after will give you the snapshots you want.



Also, if I leave a file open for a long time without making changes to it, will I end up with a bunch of different versions? Or is it smart enough not to create a new version if it sees there's been no changes?


Versions is essentially time machine for documents, so yes, it's smart enough not to do that.

kuwisdelu
Mar 1, 2011, 08:55 PM
You can't control how frequently it autosaves, but any time you save normally it creates a snapshot. So yes, if you are going to make a big change, Apple-S before and after will give you the snapshots you want.

Ah, great, at first it sounded like normally saving didn't do anything if you had Versions turned on, and it only allowed auto-saving. Very glad that was just my misunderstanding. :) That's perfect. :D

Versions is essentially time machine for documents, so yes, it's smart enough not to do that.

I only use TM for backup, and haven't really needed to use it that way, so that's good to know. Thanks!

ErikGrim
Mar 1, 2011, 10:12 PM
A few questions, if anyone has answers:

Does Lion offer any finer control over how long between Auto-saves/Versions? For some documents, an hour can be a long time between saves...

In addition to saving regularly, keep it mind it will always keep the latest changed to your document. The hour rate only pertains to older versions.