1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952
|
<html>
<head>
<title>LuaSVN</title>
</head>
<body bgcolor="white">
<h1>LuaSVN - Using Subversion from Lua</h1>
<font color="white">lua svn lua subversion lua</font>
<hr>
<h3>
<a href="#Introduction">Introduction</a>
<br>
<a href="#Basic_Operation">Basic Operation</a>
<br>
<a href="#Change_Log">Change Log</a>
<br>
<a href="#API">API</a>
<br>
<a href="#Getting_LuaSVN">Getting LuaSVN</a>
<br>
<a href="#Building_LuaSVN">Building LuaSVN</a>
<br>
<a href="#Contact_and_Further_Information">Contact and Further Information</a>
<br>
<a href="#License">License</a>
</h3>
<hr>
<h2><a name="Introduction">Introduction</a></h2>
<p align="justify">
<i>LuaSVN</i> is a library that allows to use some Subversion (SVN) facilities inside Lua programs.
</p>
<p align="justify">
<a href="http://subversion.tigris.org/">Subversion</a> is an open source version control system that has becoming very popular, currently it is
the version control system used in more than half of the open source projects according <a href="http://cia.vc/stats/vcs">
Cia.vc</a>.
</p>
<p align="justify">
Subversion is used not only in source code versioning, but also in web pages versioning, in fact, this
was the original motivation to develop LuaSVN.
</p>
<p align="justify">
LuaSVN was developed using the C API offered by Subversion and implements a basic set of functions which can be
used in a Lua program. The functions available in LuaSVN are similar to the functions offered by the
<b>svn</b> tool, but not all <b>svn</b> functions were implemented.
</p>
<h2><a name="Basic_Operation">Basic Operation</a></h2>
<p align="justify">
Subversion uses some functionalities from <i>Apache Portable Runtime</i> (APR) project, because APR offers a
standard interface to underlying platform-specific implementations, so Subversion does not need to worry about
some lower level questions. Because of this, the memory handling is done by a <i>pool</i> from APR library,
which by turn is passed as an argument to functions of the Subversion's C API.
</p>
<p align="justify">
The function <i>init_function</i> does the job to set up the initial configuration. The code
related to the specific behavior of a function then comes after.
</p>
<h2><a name="Change_Log">Change Log</a></h2>
<p align="justify">
This is a brief history of LuaSVN:
</p>
<ul>
<li><b>0.4.0</b>: Released 16 Jun 2009
<ul>
<li>LuaSVN now compiles on Windows too! Thanks to Scott Weeks.
<li>Error handling improved. Thanks again to Scott Weeks.
<li>No changes in the API.
</ul>
<li><b>0.3.0</b>: Released 14 Mar 2008
<ul>
<li>The main change was the addition of a configuration table
</ul>
<li><b>0.2.6</b>: Released 24 Oct 2007
<ul>
<li>all the parameters of <i>cleanup</i>, <i>diff</i> and <i>status</i> are now
optional.
<li>some flags in <i>diff</i>, <i>log</i>, <i>merge</i> and <i>revprop_set</i>
were changed to match the default values of the svn command line tool.
<li>the <i>makefile</i> was improved.
</ul>
<li><b>0.2.5</b>: Released 12 Oct 2007
<ul>
<li>To use LuaSVN you should do <code>require "svn"</code> now.
<li><i>commit</i>, <i>list</i>, <i>log</i>, <i>proplist</i> and <i>update</i> now
assume the current directory as a default value to <i>path</i>.
<li><i>commit</i>, <i>copy</i>, <i>delete</i>, <i>import</i>, <i>mkdir</i>
and <i>move</i> got an extra parameter to indicate a log message.
<li><i>list</i> now adds a slash to the name of an entry if that entry is a
directory. The current value associated with an entry is the last revision
in which that entry was modified.
<li>Some functions were not working properly when trying to access a repository
that has changed its directory structure, this is fixed now.
<li>The table returned by <i>proplist</i> was wrong, please read the documentation
of <i>proplist</i> to see the new return value.
<li>If you supply <b>0</b> as the revision parameter of a function then the initial
repository will be considered. In previous versions, supplying a <b>0</b> had the
same meaning of supplying a <b>nil</b>.
<li>The second parameter of <i>diff</i> is now optional too.
<li>I think some libraries were not necessary during linking, so I removed them
from the makefile. I would like to receive some <b>feedback</b> about the
<b>installation</b> of LuaSVN.
</ul>
<li><b>0.2.0</b>: Released 01 Oct 2007
<ul>
<li>Based on the <i>libsvn_client</i> library.
</ul>
<li><b>0.1.0</b>: First version
</ul>
<h2><a name="API">API</a></h2>
<p align="justify">
This version of LuaSVN works with URLs (e.g., "file:///", "http://", etc) and with paths
(e.g., "wc/", "/home/name/workingcopy", etc). It also handles correctly the extra slash in
the end of an URL or a path.
</p>
<p align="justify">
Often a LuaSVN function also has an integer optional parameter <i>revision</i> indicating
the number of the version which should be considered. If this value is not specified, or if
it is <b>nil</b>, then a default value will be supplied. Most of the time this value will be
the youngest version of the repository, in case of an URL, and the base working copy, in case
of a path. In general, if a function has an optional parameter, a default value will be
used if an argument was not supplied or if <b>nil</b> was supplied.
</p>
<p align="justify">
Some LuaSVN functions also have as an optional parameter a configuration table, named
<i>config</i>. This table has several fields that receive boolean values. Each function
indicates which fields of <i>config</i> are important for it.
</p>
<p align="justify">
The standard behavior of a LuaSVN function when an error occurs is to call <i>lua_error</i>.
</p>
<p align="justify">
The first thing you should do, so you can use LuaSVN, is to import the library. This can
be done including <code>require ("svn")</code> in your Lua program. The functions below
are in the version 0.3.0 of the LuaSVN API:
</p>
<ul>
<li><code><b>svn.add (path [, config])</b></code>
<p align="justify">
Schedules the working copy <i>path</i> for addition to the repository. It does not return anything.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>force</i>: default value is <b>false</b>
<li><i>no_ignore</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<code>svn.add ("file_or_dir")
</p>
<li><code><b>svn.cat (path_or_url [, revision])</b></code>
<p align="justify">
Gets the content of a file identified by <i>path_or_url</i>. If <i>revision</i> is not
supplied or if it is <b>nil</b>, then the most recent version will be considered.
</p>
<p align="justify">Example:
<br>
<code>content = svn.cat ("http://luasvn.googlecode.com/svn/trunk/0.2/luasvn.c")
</p>
<li><code><b>svn.checkout (url, dir [, revision [, config]])</b></code>
<p align="justify">
Gets a working copy of <i>url</i>, at <i>revision</i>, putting the new working copy
in directory <i>dir</i>. If <i>revision</i> is not supplied or if it is <b>nil</b>,
then the most recent version will be considered. Returns the number of the revision
actually checked out from the repository.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>ignore_externals</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<code>rev = svn.checkout ("http://luasvn.googlecode.com/svn/trunk/0.2/", "luasvn/")
</p>
<li><code><b>svn.cleanup ([dir])</b></code>
<p align="justify">
Implements the Subversion function <i>svn_client_cleanup</i>, that
recursively cleans up a working copy directory <i>dir</i>, finishing
any incomplete operations, removing lock files, etc. It does not
return anything.
</p>
<p>
If <i>dir</i> is not supplied or if it is <b>nil</b>,
the current directory will be considered.
</p>
<p align="justify">Example:
<br>
<code>svn.cleanup ("mydir")
</p>
<li><code><b>svn.commit ([path [, message [, config]]])</b></code>
<p align="justify">
Commits files or directories into repository. Returns the number of the new revision
of the repository or <b>nil</b> if no commit was performed. The default value to
<i>path</i> is the current directory, so <code>svn.commit()</code> has the same
meaning of <code>svn.commit("")</code> and <code>svn.commit (nil)</code>.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>keep_locks</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Examples:
<br>
<code>rev = svn.commit ()
<br>
<code>rev = svn.commit ("wc", "a log message")
</p>
<li><code><b>svn.copy (src_path, dest_path [, revision [, message]])</b></code>
<p align="justify">
Copies <i>src_path</i> to <i>dest_path</i>, a non-existent working copy path
or repository. If <i>src_path</i> is an URL, <i>revision</i> indicates which version
should be copied. If <i>revision</i> is not supplied or if it is <b>nil</b>,
then the most recent version will be considered. Returns the number of the revision
in <i>dest_path</i> if a commit was performed or <b>nil</b> otherwise.
</p>
<p align="justify">Example:
<br>
<code>rev = svn.copy ("file.c", "file:///home/sergio/newrepos/copy.c")
</p>
<li><code><b>svn.delete (path_or_url [, message [, config]])</b></code>
<p align="justify">
Deletes the file <i>path_or_url</i>. If a commit is performed, then returns
the new version of the repository, otherwise returns <b>nil</b>.
</p>
<p align="justify">
The following field of <i>config</i> is important for this function:
<ul>
<li><i>force</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<code>rev = svn.delete ("file:///home/sergio/myrepos/foo.c")
</p>
<li><code><b>svn.diff ([path1 [,rev1 [,path2 [,rev2 [,outfile [,errfile [,config]]]]]]])</b></code>
<p align="justify">
Performs a diff operation between <i>path1</i> and <i>path2</i>, which can
be either working-copy paths or URLs. The default value of <i>path1</i> is the
current directory. If <i>path2</i> is not supplied, then it is assumed to be
equal to <i>path1</i>. If <i>rev1</i> is <b>nil</b>, its default value is the
youngest version of the repository, if <i>path1</i> is an URL, and the base
revision of the working copy otherwise. If <i>rev2</i> is <b>nil</b>, its
default value is the youngest version of the repository, if <i>path2</i> is
an URL, and the current state of the working copy otherwise.
</p>
<p align="justify">
If <i>outfile</i> is absent or is equal to <b>nil</b>, then <i>stdout</i>
will be considered. In the same way, <i>stderr</i> will be considered
if <i>errfile</i> is not supplied or if it is <b>nil</b>. This function
does not return anything.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>ignore_ancestry</i>: default value is <b>false</b>
<li><i>no_diff_deleted</i>: default value is <b>false</b>
<li><i>force</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Examples:
<br>
<code>svn.diff ("file:///home/sergio/myrepos/foo.c", 11)</code>
<br>
<code>svn.diff ("wc/file1.txt")</code>
<br>
<code>svn.diff ("http://luasvn.googlecode.com/svn/trunk/0.2/luasvn.c", 20, nil, nil, "out.txt", "err.txt")</code>
</p>
<li><code><b>svn.import (path, url [, message [, config]])</b></code>
<p align="justify">
Imports file or directory <i>path</i> into repository <i>url</i>. Returns
the version of the repository or <b>nil</b> if the import was not
performed. If <i>path</i> is <b>nil</b>, then the current directory will
be considered.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>no_ignore</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Examples:
<br>
<code>rev = svn.import ("mydir", "file:///home/sergio/myrepos/", "first import")</code>
<br>
<code>rev = svn.import (nil, "file:///tmp/repos")</code>
</p>
<li><code><b>svn.list ([path_or_url [, revision [, config]]])</b></code>
<p align="justify">
Lists the entries of the directory indicated by <i>path_or_url</i>.
Returns a table where a key is the name of a directory entry and the
associated value is a table. This table has four fields:
<ul>
<li><i>author</i>: the author of the last modification in that
entry, or <b>nil</b> if the author is unknown
<li><i>date</i>: a string representing when that entry was
committed
<li><i>revision</i>: the number of the last revision in which
the entry was modified
<li><i>size</i>: the size of the entry, or <b>nil</b> if
the entry is a directory
</ul>
</p>
<p align="justify">
If <i>path_or_url</i> is not supplied or if it is <b>nil</b>,
the current directory will be considered.
</p>
<p align="justify">
If <i>revision</i> is not supplied or if it is <b>nil</b>,
then the youngest version of the repository will be considered if <i>path_or_url</i>
is an URL, otherwise the base working copy will be considered.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>false</b>
<li><i>fetch_locks</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<pre>
t = svn.list ("file:///home/sergio/myrepos/")
for name, prop in pairs (t) do
print (name)
for k, v in (prop) do
print (k, v)
end
end
</pre>
</p>
<li><code><b>svn.log ([path_or_url [,start [,end [,limit [,config]]]]])</b></code>
<p align="justify">
Returns log information associated with <i>path_or_url</i>. Returns a table
where a key is the number of a revision in which <i>path_or_url</i> was
modified. The value associated with a key is a table which has three
fields:
<ul>
<li><i>date</i>: indicating when that revision was committed
<li><i>author</i>: the author of the revision
<li><i>message</i>: the log message associated with the revision
</ul>
</p>
<p align="justify">
The default value to <i>path_or_url</i> is the current directory. The parameter
<i>start</i> indicates the first revision number the function should consider, if
<i>start</i> is not supplied or if it is <b>nil</b>, then its value will be zero.
In the same way, <i>end</i> indicates the last revision number the function should
consider, and its default value is the youngest version of the repository if
<i>path_or_url</i> is an URL, otherwise, the base working copy will be considered
as the default value.
</p>
<p align="justify">
You can also use <i>limit</i> to limit the number of entries of the table this
function returns.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>discover_changed_paths</i>: default value is <b>false</b>
<li><i>stop_on_copy</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<pre>
t = svn.list ("file:///home/sergio/myrepos/")
for name, prop in pairs (t) do
print (name)
for k, v in (prop) do
print (k, v)
end
end
</pre>
</p>
<li><code><b>svn.merge (path1, rev1, path2, rev2, wcpath [, config])</b></code>
<p align="justify">
Merges changes from <i>path1</i> at <i>rev1</i> to <i>path2</i> at <i>rev2</i>
into the working-copy path <i>wcpath</i>.
</p>
<p align="justify">
<i>path1</i> and <i>path2</i> are either URLs that refer to entries in the
repository, or paths to entries in the working copy. In case of
<i>rev1</i>/<i>rev2</i> be <b>nil</b>, the default value will be the youngest
version of the repository if <i>path1</i>/<i>path2</i> is an URL, and
the base working copy otherwise. This function does not return anything.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>ignore_ancestry</i>: default value is <b>false</b>
<li><i>force</i>: default value is <b>false</b>
<li><i>dry_run</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<pre>
svn.merge ("file:///tmp/repos1", nil, "file:///tmp/repos2/", 3, "wc")
</pre>
</p>
<li><code><b>svn.mkdir (path [, message])</b></code>
<p align="justify">
Creates a directory in a repository or in a working copy. Returns the number of the
new version of the repository, or <b>nil</b> if <i>path</i> is a working copy.
</p>
<p align="justify">Example:
<br>
<code>rev = svn.mkdir ("file:///tmp/repos1/newdir")
</p>
<li><code><b>svn.move (src_path, dest_path [, message [, config]])</b></code>
<p align="justify">
Moves <i>src_path</i> to <i>dest_path</i>, a non-existent working copy path
or repository. <i>src_path</i> must be a file or directory under version
control, or the URL of a versioned item in the repository.
</p>
<p align="justify">
Returns the number of the revision in <i>dest_path</i> if a commit was
performed or <b>nil</b> otherwise.
</p>
<p align="justify">
The following field of <i>config</i> is important for this function:
<ul>
<li><i>force</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<code>rev = svn.move ("file:///home/sergio/repos/foo.c", "file:///home/sergio/repos/fuu.c")
</p>
<li><code><b>svn.propget (path, propname [, revision [, config]])</b></code>
<p align="justify">
Returns a table whose keys are the items that have the property <i>propname</i>
and whose values are the corresponding property values for <i>propname</i>.
</p>
<p align="justify">
If <i>revision</i> is not supplied or if it is <b>nil</b>, then the youngest version
of the repository will be considered if <i>path</i> is an URL, otherwise
the base working copy will be considered.
</p>
<p align="justify">
The following field of <i>config</i> is important for this function:
<ul>
<li><i>recursive</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<pre>
t = svn.propget ("wc/", "color", nil, {recursive=true})
for k, v in pairs (t) do
print (k, v)
end
</pre>
</p>
<li><code><b>svn.proplist ([path [, revision [, config]]])</b></code>
<p align="justify">
Returns a table with the entries in <i>path</i> that have some regular property. <i>path</i>
can be an URL or working copy. The keys of the table are the name of the entries and the associated
value is a table, that contains all the properties of the entry and the associated value.
</p>
<p align="justify">
The default value to <i>path</i> is the current directory. If <i>revision</i> is not supplied of
if it is <b>nil</b>, then the youngest version of the repository will be considered if <i>path</i>
is an URL, otherwise the base working copy will be considered.
</p>
<p align="justify">
The following field of <i>config</i> is important for this function:
<ul>
<li><i>recursive</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<pre>
t = svn.proplist ("wc/", 3, {recursive=true})
for k, v in pairs (t) do
print (k)
for k, v in pairs (v) do
print (k, v)
end
end
</pre>
</p>
<li><code><b>svn.propset (path, propname, propval [, config])</b></code>
<p align="justify">
Sets <i>propname</i> to <i>propval</i> on <i>path</i>. If <i>propval</i> is <b>nil</b>
the property will be deleted. This function does not return anything and works only on
working copies.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>false</b>
<li><i>force</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<code>svn.propset ("/tmp/repos/file.txt", "color", "blue")</code>
</p>
<li><code><b>repos_create (path)</b></code>
<p align="justify">
Creates a repository whose path is <i>path</i>. If the repository already exists, it will
occur an error. This function creates only local repositories and does not return
anything.
</p>
<p align="justify">Example:
<br>
<code>svn.repos_create ("myrepos")</code>
</p>
<li><code><b>repos_delete (path)</b></code>
<p align="justify">
Deletes a repository whose path is <i>path</i>. If the repository does not exist, it will
occur an error. This function works only for local repositories and does not return
anything.
</p>
<p align="justify">Example:
<br>
<code>svn.repos_delete ("/home/name/myrepos")</code>
</p>
<li><code><b>svn.revprop_get (url, propname [, revision])</b></code>
<p align="justify">
Returns the value associated with property <i>propname</i>. This routine does not
affect the working copy; it is a pure network operation that queries an
<b>unversioned</b> property (e.g., <i>svn:date</i>) attached to a revision.
</p>
<p align="justify">
If <i>revision</i> is not supplied or if it is <b>nil</b>, then the youngest version
of the repository will be considered.
</p>
<p align="justify">Example:
<br>
<pre>
v = svn.revprop_get ("http://luasvn.googlecode.com/svn/trunk/0.2/luasvn.c", "svn:date", 21)
</pre>
</p>
<li><code><b>svn.revprop_list (url [, revision])</b></code>
<p align="justify">
Returns a table with the revision properties attached to <i>revision</i> in the
repository represented by <i>url</i>. This function does not read a working
copy and it only reads <b>unversioned</b> properties (e.g., <i>svn:log</i>)
attached to a revision.
</p>
<p align="justify">
If <i>revision</i> is not supplied or if it is <b>nil</b>, then the youngest version
of the repository will be considered.
</p>
<p align="justify">Example:
<br>
<pre>
t = svn.revprop_list ("file:///tmp/repos1/")
for k, v in pairs (t) do
print (k, v)
end
</pre>
</p>
<li><code><b>svn.revprop_set (url, propname, propval [, revision [, config]])</b></code>
<p align="justify">
Sets <i>propname</i> to <i>propval</i> on revision <i>revision</i> in the
repository represented by <i>url</i>. Returns the number of the revision
actually affected. Notice that unless the administrator creates a
pre-revprop-change hook in the repository, this feature will fail.
</p>
<p align="justify">
If <i>revision</i> is not supplied or if it is <b>nil</b>, then the youngest version
of the repository will be considered.
</p>
<p align="justify">
The following field of <i>config</i> is important for this function:
<ul>
<li><i>force</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<code>r = svn.revprop_set ("file:///tmp/repos/file.txt", "color", "blue")</code>
</p>
<li><code><b>svn.status ([path [, revision [, config]]])</b></code>
<p align="justify">
Returns a table with the status of the working copy <i>path</i>. Uses <i>revision</i>
as the revision number when contacting the repository to get more information. The keys of
the table are items in <i>path</i> and the associated value of an item is a string
following the same format of the string returned by a <code>svn status</code> command.
</p>
<p align="justify">
The default value of <i>path</i> is the current directory. If <i>revision</i> is not supplied
or if it is <b>nil</b>, then the youngest version of the repository will be considered.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>verbose</i>: default value is <b>false</b>
<li><i>show_updates</i>: default value is <b>false</b>
<li><i>no_ignore</i>: default value is <b>false</b>
<li><i>ignore_externals</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Example:
<br>
<pre>
t = svn.status ("wc")
for k, v in pairs (t) do
print (k, v)
end
</pre>
</p>
<li><code><b>svn.update ([path [, revision]])</b></code>
<p align="justify">
Updates the working tree <i>path</i> to <i>revision</i>. Returns the number
of the revision to which <i>revision</i> was resolved.
</p>
<p align="justify">
The default value to <i>path</i> is the current directory. If <i>revision</i>
is not supplied or if it is <b>nil</b>, then the youngest version
of the repository will be considered.
</p>
<p align="justify">
The following fields of <i>config</i> are important for this function:
<ul>
<li><i>recursive</i>: default value is <b>true</b>
<li><i>ignore_externals</i>: default value is <b>false</b>
</ul>
</p>
<p align="justify">Examples:
<br>
<code>r = svn.update ()</code>
<br>
<code>r = svn.update ("wc/", 12)</code>
</p>
</ul>
<h2><a name="Getting_LuaSVN">Getting LuaSVN</a></h2>
<p align="justify">
Click <a href="http://luaforge.net/frs/?group_id=289">here</a> to download LuaSVN
from LuaForge.
</p>
<h2><a name="Building_LuaSVN">Building LuaSVN</a></h2>
<p align="justify">
There are several ways to build LuaSVN. One easy way to install
LuaSVN is by using <a href="http://luarocks.org/">LuaRocks</a>.
If you can not install LuaSVN using LuaRocks, it may be useful
to take a look in
<a href="http://lists.luaforge.net/pipermail/luarocks-developers/2007-December/000216.html">
this message</a>of the LuaRocks mailing list and the
<a href="http://lists.luaforge.net/pipermail/luarocks-developers/2008-January/000239.html">
corresponding answer</a>.
</p>
<p align="justify">
On Ubuntu, if you have the right permissions, you can do this:
<ol>
<li>Install <i>libsvn-dev</i>:
<pre>
sudo apt-get install libsvn-dev
</pre>
<li>Type <i>make</i>
<li>Copy <i>svn.so</i> to a place where your Lua
installation can find it, a typical one is
<i>/usr/local/lib/lua/5.1/</i>.
</ol>
</p>
<p align="justify">
If you can not use a tool like <i>apt-get</i>, then you need to install Subversion and APR.
After this, you should edit the <i>makefile</i> and adjust the variables <i>APR</i>, <i>APR_UTIL</i>
and <i>SUBVERSION</i>. You should also use the right definition of <i>LDFLAGS</i>, as explained
in the makefile.
</p>
<p align="justify">
To be able to use the URLs with <i>http</i> protocol, you will also need <i>libneon</i>, this can be a little
bit complicated, but, in resume, you do not need to worry if you are building LuaSVN using <i>apt-get</i> and
you should get <i>libneon-0.25.X</i> if you are building LuaSVN by yourself.
</p>
<h2><a name="Contact_and_Further_Information">Contact and Further Information</a></h2>
<p align="justify">
LuaSVN was developed by Sérgio Medeiros and is free software.
If you have any comments or doubts, please send an e-mail to the
<a href="http://www.lua.org/lua-l.html">Lua list</a>
or for me (smedeiros at inf dot puc-rio dot br).
</p>
<h2><a name="License">License</a></h2>
<p align="justify">
Copyright © 2007-2008 LabLua.
</p>
<p align="justify">
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
</p>
<p align="justify">
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
</p>
<p align="justify">
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</p>
</body>
</html>
|