Navigation: Developing Apps > BINETIX® AGE™ API > Plugins > Version Control Manager > Modules vcs_txn |
Scroll Prev Top Next More |
This module is particularly designed to operate with version control transactions, if supported by the VCS engine. The functions provided by vcs_txn allows you start simultaneously multiple transactions and to manage them asynchronously. The source code below shows in few straightforward steps how to: ✓Deploy a new SVN repository; ✓Setup the repository with a canonical directory structure; ✓Add 10 binary blocks as named files into "/trunk/" node - each of them executed concurrently in a separate process. ✓Browse the repository's directory tree To achieve this you have to apply only these functions: 2)create/2 4)browse/6 |
> vcs:register(test, svn, #{path => age_tools:get_data_path() ++ "repos/1"}). > {ok, _} = vcs:create(test).
> vcs_txn:commit_actions_list(test, [ {add_dir, "/branches"}, {add_dir, "/docs"}, {add_dir, "/release"}, {add_dir, "/tags"}, {add_dir, "/trunk"} ]).
> Sequence = 10. [ spawn(fun() -> vcs_txn:commit_actions_list(test, [ {add_file, lists:flatten(io_lib:format("/trunk/~s-~p", [age_tools:gen_uid(uuid), N])), <<"TEST DATA">>} ]) end) || N <- lists:seq(1, Sequence) ].
> vcs:browse(test). {repository_tree,[{revision,11}, {node,[{name,"/release"}, {parent,"/"}, {type,dir}, {id,"3-1.0.r1/5"}, {origin_revision,1}, {properties,[]}, {history_list,[{"/release",1}]}]}, {node,[{name,"/docs"}, {parent,"/"}, {type,dir}, {id,"2-1.0.r1/4"}, {origin_revision,1}, {properties,[]}, {history_list,[{"/docs",1}]}]}, {node,[{name,"/branches"}, {parent,"/"}, {type,dir}, {id,"0-1.0.r1/3"}, {origin_revision,1}, {properties,[]}, {history_list,[{"/branches",1}]}]}, {node,[{name,"/tags"}, {parent,"/"}, {type,dir}, {id,"4-1.0.r1/6"}, {origin_revision,1}, {properties,[]}, {history_list,[{"/tags",1}]}]}, {node,[{name,"/trunk"}, {parent,"/"}, {type,dir}, {id,"5-1.0.r11/5"}, {origin_revision,1}, {properties,[]}, {history_list,[{"/trunk",11}, {"/trunk",10}, {"/trunk",9}, {"/trunk",8}, {"/trunk",7}, {"/trunk",6}, {"/trunk",5}, {"/trunk",4}, {[...],...}, {...}|...]}]}]}.
> vcs:browse(test, "/trunk/"). {repository_tree,[{revision,11}, {node,[{name,"/trunk/D4B4462E-CF48-C411-A304-1696A48139A3-7"}, {parent,"/trunk"}, {type,file}, {id,"1-5.0.r5/3"}, {origin_revision,5}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/D4B4462E-CF48-C411-A304-1696A48139A3-7", 5}]}]}, {node,[{name,"/trunk/B0FB4DC7-F431-A8A3-2B7E-E41C4BF32BE3-2"}, {parent,"/trunk"}, {type,file}, {id,"1-11.0.r11/3"}, {origin_revision,11}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/B0FB4DC7-F431-A8A3-2B7E-E41C4BF32BE3-2", 11}]}]}, {node,[{name,"/trunk/2E60D2D5-97E5-67C6-AEBA-D368DED52EAA-8"}, {parent,"/trunk"}, {type,file}, {id,"1-4.0.r4/4"}, {origin_revision,4}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/2E60D2D5-97E5-67C6-AEBA-D368DED52EAA-8", 4}]}]}, {node,[{name,"/trunk/402BF1DB-909F-D610-070C-DEEC7C7520A0-10"}, {parent,"/trunk"}, {type,file}, {id,"1-2.0.r2/4"}, {origin_revision,2}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/402BF1DB-909F-D610-070C-DEEC7C7520A0-10", 2}]}]}, {node,[{name,"/trunk/ED49F6A8-D7B5-E4B9-5C58-C923C4FEE120-1"}, {parent,"/trunk"}, {type,file}, {id,"1-10.0.r10/3"}, {origin_revision,10}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/ED49F6A8-D7B5-E4B9-5C58-C923C4FEE120-1", 10}]}]}, {node,[{name,"/trunk/06B6A518-68A0-6E59-5C40-90A8A8B8BB31-3"}, {parent,"/trunk"}, {type,file}, {id,"1-9.0.r9/3"}, {origin_revision,9}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/06B6A518-68A0-6E59-5C40-90A8A8B8BB31-3", 9}]}]}, {node,[{name,"/trunk/896FA7A9-34C2-A609-C795-7E53B16BF59E-9"}, {parent,"/trunk"}, {type,file}, {id,"1-3.0.r3/4"}, {origin_revision,3}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/896FA7A9-34C2-A609-C795-7E53B16BF59E-9", 3}]}]}, {node,[{name,"/trunk/549555AB-ECC1-7AA2-7070-CF724662517D-4"}, {parent,"/trunk"}, {type,file}, {id,"1-8.0.r8/3"}, {origin_revision,8}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/549555AB-ECC1-7AA2-7070-CF724662517D-4", 8}]}]}, {node,[{name,"/trunk/6AEFCA02-4D2D-64D0-DA80-5C63F84CF7DD-5"}, {parent,"/trunk"}, {type,file}, {id,"1-7.0.r7/3"}, {origin_revision,7}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/6AEFCA02-4D2D-64D0-DA80-5C63F84CF7DD-5", 7}]}]}, {node,[{name,"/trunk/EC62E6D7-DD4B-2287-02E7-E50C5123D4CC-6"}, {parent,"/trunk"}, {type,file}, {id,"1-6.0.r6/3"}, {origin_revision,6}, {size,100000}, {properties,[]}, {history_list,[{"/trunk/EC62E6D7-DD4B-2287-02E7-E50C5123D4CC-6", 6}]}]}]} |
Copyright © 2013-2024 BINETIX LLC. All rights reserved. The content is maintained and distributed only at www.binetix.net according to the following terms and conditions.