monotone

monotone Commit Details

Date:2010-02-24 22:29:21 (9 years 2 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.lib.automate-stdio
Commit:fc499bab83e6a0ae0a3065064780f7f1afc2a9be
Parents: 6673c1e279f8d31db93a828f40fb9b4d88a08de4
Message:- Added the prototype for the sync() method.

- Corrected some comments.
- Updated the POD documentation.
Changes:
Mlib/Monotone/AutomateStdio.pm (4 diffs)
Mlib/Monotone/AutomateStdio.pod (13 diffs)

File differences

lib/Monotone/AutomateStdio.pm
332332
333333
334334
335
335336
336337
337338
......
12951296
12961297
12971298
1298
1299
1300
12991301
13001302
13011303
......
15221524
15231525
15241526
1525
1526
1527
1528
15271529
15281530
15291531
......
30013003
30023004
30033005
3004
3005
3006
3007
30063008
30073009
30083010
sub supports($$);
sub suppress_utf8_conversion($$);
sub switch_to_ws_root($$);
sub sync($;$$@);
sub tags($$;$);
sub toposort($$@);
#
# Routine - get_base_revision_id
#
# Description - Get the revision upon which the workspace is based.
# Description - Get the id of the revision upon which the workspace is
# based.
#
# Data - $self : The object.
# $buffer : A reference to a buffer that is to contain
#
# Routine - get_current_revision_id
#
# Description - Get the revision that would be created if an unrestricted
# commit was done in the workspace.
# Description - Get the id of the revision that would be created if an
# unrestricted commit was done in the workspace.
#
# Data - $self : The object.
# $buffer : A reference to a buffer that is to contain
#
# Routine - toposort
#
# Description - Sort the specified revisions such that the ancestors come
# out first.
# Description - Sort the specified revision ids such that the ancestors
# come out first.
#
# Data - $self : The object.
# $list : A reference to a list that is to contain
lib/Monotone/AutomateStdio.pod
5353
5454
5555
56
57
58
59
60
61
62
63
64
5665
5766
5867
......
409418
410419
411420
412
421
413422
414423
415424
......
429438
430439
431440
432
441
433442
434443
435444
......
444453
445454
446455
447
448
456
457
449458
450459
451460
......
747756
748757
749758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
750775
751776
752777
......
765790
766791
767792
793
794
795
796
797
798
768799
769800
770801
......
776807
777808
778809
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
779850
780851
781852
......
883954
884955
885956
957
886958
887959
888960
961
962
889963
890964
891965
......
898972
899973
900974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
901994
902995
903996
......
9161009
9171010
9181011
919
1012
9201013
9211014
9221015
......
9291022
9301023
9311024
1025
9321026
9331027
9341028
......
9511045
9521046
9531047
1048
9541049
9551050
9561051
......
10891184
10901185
10911186
1092
1093
1094
1095
1096
1097
1098
1099
1100
1187
1188
1189
1190
1191
1192
1193
1194
1195
11011196
1197
1198
1199
11021200
11031201
11041202
Creates a new Monotone::AutomateStdio object, using the database named in $db.
=item B<$mtn = Monotone::AutomateStdio-E<gt>new_from_service($service,
[\@options])>
Creates a new Monotone::AutomateStdio object, using the named network service
(which is expressed as a hostname optionally followed by a colon and a port
number).
(feature: MTN_REMOTE_CONNECTIONS)
=item B<$mtn = Monotone::AutomateStdio-E<gt>new_from_ws($ws[, \@options])>
Creates a new Monotone::AutomateStdio object, using the workspace named in $ws.
=item B<$mtn-E<gt>get_base_revision_id(\$buffer)>
Get the revision upon which the workspace is based.
Get the id of the revision upon which the workspace is based.
=item B<$mtn-E<gt>get_content_changed(\@list, $revision_id, $file_name)>
output by using the specified options and file restrictions. If \$buffer is
passed then the output from the command is simply placed into the
variable. However if \@list is passed then the output is returned in exactly
the same format as for the $mtn-E<gt>get_current_revision() method.
the same format as for the $mtn-E<gt>get_revision() method.
The $options argument is a list of valid options, with some having
arguments. For example, one could call this method specifying all of the
=item B<$mtn-E<gt>get_current_revision_id(\$buffer)>
Get the revision that would be created if an unrestricted commit was done
in the workspace.
Get the id of the revision that would be created if an unrestricted commit was
done in the workspace.
=item B<$mtn-E<gt>get_db_name()>
Get a list of parents for the specified revision.
=item B<$mtn-E<gt>pull([@options[, $service[, $pattern]]])>
Synchronises database changes from the specified remote server to the local
database but not in the other direction. Other details are identical to the
$mtn-E<gt>sync() method.
(feature: MTN_SYNCHRONISATION)
=item B<$mtn-E<gt>push([@options[, $service[, $pattern]]])>
Synchronises database changes from the local database to the specified remote
server but not in the other direction. Other details are identical to the
$mtn-E<gt>sync() method.
(feature: MTN_SYNCHRONISATION)
=item B<$mtn-E<gt>put_file(\$buffer, $base_file_id, \$contents)>
Put the specified file contents into the database, optionally basing it on the
(feature: MTN_READ_PACKETS)
=item B<$mtn-E<gt>register_error_handler($severity[, $handler
[, $client_data]])>
Registers an error handler for the object rather than the class. For further
details please see the description of the class method.
=item B<$mtn-E<gt>register_db_locked_handler([$handler[, $client_data]])>
Registers a database locked handler for the object rather than the class. For
Registers an I/O wait handler for the object rather than the class. For further
details please see the description of the class method.
=item B<$mtn-E<gt>register_stream_handle($stream[, $handle]])>
Registers the file handle specified in $handle so that it will receive data
from the specified mtn output stream. $stream can be one of MTN_P_STREAM or
MTN_T_STREAM. If no file handle is given then any existing file handle is
unregistered for that stream.
Please note:
=over 4
=item 1)
It is vitally important that if you register some sort of pipe or socket to
receive mtn stream output, that any data sent down it is read immediately and
independently from the code calling the method generating the output (either by
using a thread or another process). Not doing so could easily cause a deadlock
situation to occur where the method stops processing, waiting for the pipe or
socket to empty before proceeding.
=item 2)
The output streams are largely sent as received from the mtn subprocess (please
refer to the Monotone documentation for further details on the format). The
only difference is that since the `l' or last message (which marks the end of a
command's output) is only sent once by mtn, this class duplicates it onto any
registered stream so that the reader knows when there is no more data for a
command.
=item 3)
In order to get the stream constants into your namespace you need to use the
following to load in this library.
use Monotone::AutomateStdio qw(:streams);
=back
(feature: MTN_STREAM_IO)
=item B<$mtn-E<gt>roots(\@list)>
Get a list of root revisions, i.e. revisions with no parents.
MTN_M_SELECTOR
MTN_P_SELECTOR
MTN_READ_PACKETS
MTN_REMOTE_CONNECTIONS
MTN_SET_ATTRIBUTE
MTN_SET_DB_VARIABLE
MTN_SHOW_CONFLICTS
MTN_STREAM_IO
MTN_SYNCHRONISATION
MTN_U_SELECTOR
MTN_W_SELECTOR
being discussed is only available if $mtn-E<gt>supports() returns true for the
specified feature.
=item B<$mtn-E<gt>sync([@options[, $service[, $pattern]]])>
Synchronises database changes between the local database and the specified
remote server. $service is in exactly the same format as for the
Monotone::AutomateStdio->new_from_service() constructor. $pattern is a branch
pattern to include in the synchronisation operation.
The $options argument is a list of valid options, with some having
arguments. For example, one could call this method specifying all of the
options like this:
$mtn->sync(["exclude" => "experiments.hacks",
"key-to-push" => "me@mydomain.com",
"max-netsync-version" => 2,
"min-netsync-version" => 1,
"set-default");
(feature: MTN_SYNCHRONISATION)
=item B<$mtn-E<gt>tags(\$buffer | \@list[, $branch_pattern])>
Get all the tags attached to revisions on branches that match the specified
=item B<$mtn-E<gt>toposort(\@list[, $revision_id ...])>
Sort the specified revisions such that the ancestors come out first.
Sort the specified revision ids such that the ancestors come out first.
=back
Monotone::AutomateStdio->new()
Monotone::AutomateStdio->new_from_db()
Monotone::AutomateStdio->new_from_service()
Monotone::AutomateStdio->new_from_ws()
The following method returns true or false (but it does not indicate success or
Monotone::AutomateStdio->register_db_locked_handler()
Monotone::AutomateStdio->register_error_handler()
Monotone::AutomateStdio->register_io_wait_handler()
Monotone::AutomateStdio->register_stream_handle()
Monotone::AutomateStdio->suppress_utf8_conversion()
$mtn->closedown()
subprocess (for example when a database locked condition is detected). When
this happens the subprocess is reaped and its id is reset, i.e. the
$mtn-E<gt>get_pid() method returns 0. However if the subprocess should exit
unexpectedly then an exception is raised but no reaping or process id resetting
takes place. Therefore the application using this class may wish to have a
signal handler registered for SIGCHILD signals that can trigger a call to the
$mtn-E<gt>closedown() method or destroy the object concerned in the event of an
error. In order to distinguish between legitimate terminations of the mtn
subprocess and failures, simply compare the reaped process id against that
returned by the $mtn-E<gt>get_pid() method. If there is a match then there is a
problem, otherwise, as far as this class is concerned, there is nothing to
worry about.
unexpectedly whilst processing a request then an exception is raised but no
reaping or process id resetting takes place. Therefore an application using
this class may wish to have a signal handler registered for SIGCHILD signals
that can indirectly trigger a call to the $mtn-E<gt>closedown() method or
destroy the object concerned in the event of an error. In order to distinguish
between legitimate terminations of the mtn subprocess and failures, simply
compare the reaped process id against that returned by the $mtn-E<gt>get_pid()
method. If there is a match then there is a problem, otherwise, as far as this
class is concerned, there is nothing to worry about.
Please note that all SIGPIPE signals are set to be ignored as soon as the first
mtn subprocess is started by this class.
=head2 Use Of SIGALRM
In order to reliably shutdown the mtn subprocess, the alarm() routine is used

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status