Versioning

Versioning might be a possibility in v2.0 when all contents will be file based. Therefore versioning would be some sort of “archived backups”. However, it’s only a possibility - I can’t promise this at the moment.

Yes, that would be really fine and useful. We’ll see…

Alb

The more I think about this, the more I think it would be tremendously neat if DTP 2 could have a versioning system of some sort. It is something that could be used by all people who use dtpro to write and create.

Some thoughts about versioning: It would be cool if for each document one could have a simple versioning system that would have three features: 1. both the version number and some sort of brief comment describing the version would be embedded in the file metadata. 2. easily updatable in DTP with absolutely minimal difficulty (i.e. creating a new version should be easier than saving under a new name, because the directory shouldn’t change. A thin little ribbon directly above rtf and text files could for instance allow versioning to be turned on or off, for a new major, minor, or dot version to be set, and for a comment to be set. 3. It is obviously important for DTP to maintain “knowledge” about which version is the current. All older versions can be accessed explicitly. In other words, it would be great i DTP would take care of hiding all the previous versions unless explicitly asked for and, likewise, allow one to (or default to) only showing the most current version in searches, or in backups. I think this could be done by including storing the old versions within a package stored within the same folder as the current document. Probably it makes sense to have these ‘rdiff’ based, at least when one requests compression. Doing so would also allow backups to be discarded in the file system or otherwise when not needed.

Those are just some thoughts, but yes, a big enthusiastic vote for versioning.

cheers,

erico

I have also touched on this subject already… and want to give my vote for it.

Actually, versioning was the major point that sold CopyWrite to me, even though some other writing applications had a lot other nice features to offer.

CopyWrite’s very rudimentary implementation of versioning is all I would ask for.

There are no variants or branches in the versioning system; just a straight main route. Whenever you decide to do major changes, you can “freeze” the current version (i.e. make a copy of it). The freezed version becomes then an item in the version list, which contains all freezed versions of the document, along with their freezing-date/time. Should you decide to come back to a previous version, the current gets frozen and the old, frozen one, becomes the current.

This would be certainly doable with DT2 on a file-basis; it is mainly copying documents and time-stamping/naming them appropriately.

Additionally, an edit/closed-tag (padlock) would be needed, which could be useful anyway, if you want to make a document/database entry read-only. This is another feature, I would ask for.

Ahoj,

Daniel

Locking is in DT Pro now from the contextual menu. Select the the document/database entry and right-click, select from the “Locking” options.

It’s also easy to use a script to lock the current document (old version) and to create a duplicate (new version):


tell application "DEVONthink Pro"
	set theSelection to the selection
	repeat with theRecord in theSelection
		if (exists parent 1) of theRecord then
			set theDuplicate to duplicate record theRecord to (parent 1 of theRecord)
		else
			set theDuplicate to duplicate record theRecord
		end if
		set name of theDuplicate to (name of theRecord)
		set locking of theRecord to true
	end repeat
end tell

An enhanced version of such a script could move the archived documents to a subgroup too.

You guys are too fast for me :open_mouth:

Greg: With DT I always have the feeling, that there might be a hidden knob, that does exactly what I intended to do. This is also why I often hesitate to ask the forum: I might just look stupid. Like now. Thanks a lot for the tip.

cgrunenbeg: Well… thanks for the code in the first place. However, until now I could never get into the habbit of using scripts exhaustively, although I know, in principle, they are awfully powerful.

I think, my gripes are firstly the sheer number of entries in the scripts-menu, and secondly, the buggyness (sp?) of a lot of scripts. Scripts seem to be especially bad at exception handling, if e.g. a path is set wrong, it won’t ask to seek the right path, but instead quit without doing anything. Also, they tend to be very slow.

The reason I am bashing them is mainly to beg, if you could implement versioning into DT2 in a more user-friendly and elegant way :wink:

Thank you anyway,

Daniel

Most scripts shipped with DT Pro should present useful error messages (v1.1 will improve some scripts in that area). And scripting DT Pro is (compared to other scriptable applications) actually very fast (for example the speed of importing mails is limited by the mail client, not by DT Pro).

But don’t run scripts via Apple’s Script Editor - that’s always painfully slow (around 10 times slower than running them via the Scripts menu).

I would not hesitate to ask questions in the forum-that’s what it’s for! :smiley:

I also forgot to mention that you can toggle the lock/unlock status with the padlock icon that appears at the top of the viewer pane. I find the contextual menu easier to use, however some prefer the icon.

Thanks for the heads-up on EverNote. It kills me at work to not have DT on my computer. For what it’s worth, I also would love a versioning system in DTP. I’m always hesitant to ask for more features because I would hate to see DT become bloated like anyother program made to please everyone (MS Word). Thanks again.

Versioning would be a great feature to add to DT. As stated by others; a simple, elegant versioning process would be appreciated.

Very few knowledge management programs handle versioning well. Most of the time, versioning involves complicated check-in/check-out schemes (for network based systems, of which, DT will hopefully be in the near future). Perhaps one of the better versioning schemes I have tried is that contained in Near Time’s Flow application. Although this application is confusing to use, its versioning system is good.

I would definitely pay more for a well designed versioning feature.

Here are two more advanced scripts. The first one creates locked copies of selected contents in subgroups, the second one switches an old and the current version of the selected content.


-- Create new version
-- Created by Christian Grunenberg on Wed Feb 01 2006.
-- Copyright (c) 2006. All rights reserved.

tell application "DEVONthink Pro"
	try
		set theSelection to the selection
		repeat with theRecord in theSelection
			if type of theRecord is not group then
				set theLocation to location of theRecord
				set theLocation to theLocation & my replace_chars(name of theRecord, "/", "_") & " Versions"
				set theGroup to create location theLocation
				set theDuplicate to duplicate record theRecord to theGroup
				set name of theDuplicate to (modification date of theRecord) as string
				set locking of theDuplicate to true
			end if
		end repeat
	on error error_message number error_number
		if the error_number is not -128 then
			try
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

on replace_chars(this_text, search_string, replacement_string)
	local od
	set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, search_string}
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to od
	return this_text
end replace_chars


-- Restore old version
-- Created by Christian Grunenberg on Wed Feb 01 2006.
-- Copyright (c) 2006. All rights reserved.

tell application "DEVONthink Pro"
	try
		set theSelection to the selection
		if (count of theSelection) is not 1 or type of item 1 of theSelection is group then error "Please select one content."
		set theRecord to item 1 of theSelection
		set theLocation to location of theRecord
		set theLocation to theLocation & my replace_chars(name of theRecord, "/", "_") & " Versions"
		if (exists record at theLocation) is false then error "No versions have been saved."
		set theGroup to get record at theLocation
		if type of theGroup is not group then "No versions have been saved."
		set theVersions to name of children of theGroup
		if theVersions is {} then error "No versions have been saved."
		choose from list theVersions with prompt "Select a version to restore"
		if the result is not false then
			set theVersion to item 1 of the result
			set theDuplicate to child named theVersion of theGroup
			set locking of theDuplicate to false
			if exists parent 1 of theRecord then
				move record theDuplicate to (parent 1 of theRecord)
			else
				move record theDuplicate to root of current database
			end if
			set name of theDuplicate to name of theRecord
			move record theRecord to theGroup
			set name of theRecord to (modification date of theRecord) as string
			set locking of theRecord to true
		end if
	on error error_message number error_number
		if the error_number is not -128 then
			try
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

on replace_chars(this_text, search_string, replacement_string)
	local od
	set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, search_string}
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to od
	return this_text
end replace_chars

Christian,

Thank you. I played around with these and the work really well. That they could be written is a testament to the power of Devon think’s scripting. That you did them for the users is a testament that you are really great! It’s part of what makes devon think such a great program to use–the fact that there’s such nice people behind it.

Thank you
erico

btw, anyone wanting a good example of a script to use to learn the logic of devon think’s storage system and its scripting abilities should study these scripts… :unamused:

Christian,

I also want to join the praise! Though I usually (as said above) don’t like scripts, these work extremely well. Unlike many other applications, this one gets better and better over time. Probably, like Erico said, because you really have attentive ears to the users problems and needs.

Thanks a lot,

Daniel

Erico & Daniel,

thank you :smiley:

Hey Christian,

Could the Devonthink team create a place on the server to download and upload scripts? Not a message board, just the sripts with a description. I think it would be a great way to extend the usability of DTP and perhaps show those running DTP demo how scriptable it really is. More selfishly, it would save me from sifting through this message board to find all of your little gems. Thanks for all the new features through AS.

Gabe

Gabe,

we’ll probably add some of the scripts I’ve posted recently either to the next releases or to the stand-along examples package (see download page).

I was just pointed to this discussion from a question i asked in the usage scenarios by Annard. I know I’m coming in late, but I’d just like to cast my vote for a more built-in versioning system. The scripts are great; but part of versioning includes the basic ability to for the versions to be smaller than their normal size, and for there to be some basic comparison between previous versions. I have no idea how programming any of this would be, but even the ability to work with Subversion (and its like) vis-a-vis the DT database in v.2 might be sufficient, though something similar built in would be phenomenal. Since it’s open-source, maybe even a look into Subversion might be possible (you could pull an Apple, using open-source in a commercial app, :slight_smile: ).

I understand and agree with the bloat-ware fears; but this would obviously be a “pro” feature for people who use DTpro as their information management backbone, and can really use these types of features.

The bloat fear is a very real one, given that DT is overwhelming for a newbie as is. Not to mention that more features means more code, which means more bugs and more testing, which in turn mean longer delays between versions and increased clost.

It seems that Christian is solving a lot of feature requests with scripts. This makes me wonder if it would be worth adding a single feature that would allow the user to invoke specific scripts from the Toolbar, Context Menu, and from user-specified hotkeys. That way “features” could be added or enabled through configuration, rather than increasing the size of the codebase.

Regarding versioning, I’m generally for it. I would much rather have the contents of the DT db checked into cvs or subversion, which should work fine with the 2.0 plans for a filesystem-based db.

At least the scripts menu can be already added to the toolbar. And it’s possible to define shortcuts by modifying the filename of the scripts - just add three underscores and the desired shortcut. For example “Demo___Cmd+Ctrl+A.scpt” gets the shortcut Cmd-Ctrl-A.

Another possibility to define shortcuts is of course to use System Preferences > Keyboard & Mouse > Shortcuts.