Subversion Repositories DevTools

Rev

Rev 1348 | Rev 2048 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
311 dpurdie 1
########################################################################
2
# Copyright (C) 1998-2008 ERG Limited, All rights reserved
3
#
4
# Module name   : jats_svn.pl
5
# Module type   : Jats Utility
6
# Compiler(s)   : Perl
7
# Environment(s): Jats
8
#
9
# Description   : A script to perform a number of SVN utility functions
10
#                 The script will:
11
#                   Delete a package
12
#                   Create a package
13
#                   Import source to a package
14
#
15
#
16
#......................................................................#
17
 
18
require 5.006_001;
19
use strict;
20
use warnings;
21
use JatsError;
22
use JatsSvn qw(:All);
23
use JatsLocateFiles;
379 dpurdie 24
use JatsProperties;
311 dpurdie 25
 
379 dpurdie 26
 
311 dpurdie 27
use Pod::Usage;                                 # required for help support
28
use Getopt::Long qw(:config require_order);     # Stop on non-option
29
use Cwd;
30
use File::Path;
31
use File::Copy;
32
use File::Basename;
33
use File::Compare;
387 dpurdie 34
use Encode;
311 dpurdie 35
 
36
my $VERSION = "1.0.0";                          # Update this
37
 
38
#
39
#   Options
40
#
41
my $opt_debug   = $ENV{'GBE_DEBUG'};            # Allow global debug
42
my $opt_verbose = $ENV{'GBE_VERBOSE'};          # Allow global verbose
43
my $opt_help = 0;
44
 
45
#
46
#   Globals
47
#
48
my $opr_done;                                   # User has done something
49
 
50
#-------------------------------------------------------------------------------
51
# Function        : Mainline Entry Point
52
#
53
# Description     :
54
#
55
# Inputs          :
56
#
57
my $result = GetOptions (
58
                "help:+"        => \$opt_help,              # flag, multiple use allowed
59
                "manual:3"      => \$opt_help,              # flag
60
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
61
 
62
                );
63
 
64
                #
65
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
66
                #
67
 
68
#
69
#   Process help and manual options
70
#
71
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
72
pod2usage(-verbose => 1) if ($opt_help == 2 );
73
pod2usage(-verbose => 2) if ($opt_help > 2);
74
 
75
#
76
#   Configure the error reporting process now that we have the user options
77
#
78
ErrorConfig( 'name'    =>'SVN',
79
             'verbose' => $opt_verbose,
80
            );
81
 
82
#
369 dpurdie 83
#   Reconfigure the options parser to allow subcommands to parse options
311 dpurdie 84
#
85
Getopt::Long::Configure('permute');
86
 
87
#
88
#   Process command
89
#   First command line argument is a subversion command
90
#
91
my $cmd = shift @ARGV || "help";
92
CreatePackage()                        if ( $cmd =~ m/^create/ );
385 dpurdie 93
DeleteBranch()                         if ( $cmd =~ m/^delete-branch/ );
311 dpurdie 94
DeletePackage()                        if ( $cmd =~ m/^delete-package/ );
95
ImportPackage()                        if ( $cmd =~ m/^import/ );
96
SvnRepoCmd($cmd, @ARGV)                if ( $cmd eq 'ls' );
363 dpurdie 97
TestSvn()                              if ($cmd eq 'test');
369 dpurdie 98
ShowPaths()                            if ( $cmd =~ m/^path/ );
99
ShowTag()                              if ( $cmd =~ m/^tag/ );
100
ShowUrl()                              if ( $cmd =~ m/^url/ );
311 dpurdie 101
 
102
pod2usage(-verbose => 0, -message => "No valid operations specified") unless ( $opr_done );
103
exit 0;
104
 
105
#-------------------------------------------------------------------------------
369 dpurdie 106
# Function        : ShowPaths
107
#
108
# Description     : Show PATHS
109
#
110
# Inputs          : 
111
#
112
# Returns         : 
113
#
114
sub ShowPaths
115
{
116
    #
117
    #   Parse more options
118
    #
119
    GetOptions (
120
                "help:+"        => \$opt_help,
121
                "manual:3"      => \$opt_help,
122
                ) || Error ("Invalid command line" );
123
 
124
    #
125
    #   Subcommand specific help
126
    #
127
    SubCommandHelp( $opt_help, "Subversion Paths") if ($opt_help || $#ARGV >= 0);
128
 
129
    #
130
    #   Display known PATHS
131
    #
132
    my ( $pSVN_URLS, $pSVN_URLS_LIST) = SvnPaths();
133
    print ("Configured SubVersion Repository Paths\n");
134
    print sprintf("    %-20s %s\n", 'Tag', 'URL Prefix');
135
 
136
    foreach my $key ( @{$pSVN_URLS_LIST} )
137
    {
138
        print sprintf("    %-20s %s\n", $key || 'Default', $pSVN_URLS->{$key} );
139
    }
140
 
141
    $opr_done = 1;
142
}
143
 
144
#-------------------------------------------------------------------------------
145
# Function        : ShowTag
146
#
147
# Description     : Convert a URL into a TAG
148
#                   Convert the current workspace info into a TAG
149
#
150
# Inputs          : url                     - Url to convert (optional)
151
#                   Options
152
#                       -help[=n]           - Show help
153
#                       -man                - Show manual
154
#                       -url=url            - Convert URL
155
#                       -path=path          - Convert Workspace
156
#
157
# Returns         : Nothing
158
#
159
sub ShowTag
160
{
161
    my $opt_path;
162
    my $opt_url;
163
 
164
    #
165
    #   Parse more options
166
    #
167
    GetOptions (
168
                "help:+"        => \$opt_help,
169
                "manual:3"      => \$opt_help,
170
                "path:s"        => \$opt_path,
171
                "url:s"         => \$opt_url,
172
                ) || Error ("Invalid command line" );
173
 
174
    #
175
    #   Subcommand specific help
176
    #
177
    SubCommandHelp( $opt_help, "Url to Tag") if ($opt_help);
178
 
179
    #
180
    #   Bare argument is a URL
181
    #   If no arguments provided assume a path of the current directory
182
    #
183
    $opt_url = shift (@ARGV) if ( $#ARGV == 0 );
184
    $opt_path = '.' unless ( defined $opt_path || defined $opt_url );
185
 
186
    #
187
    #   Sanity Tests
188
    #
189
    Error ("Cannot specify both a URL and a PATH")
190
            if ( defined $opt_url && defined $opt_path );
191
    Warning ("Too many arguments") if ( $#ARGV >= 0 );
192
 
193
    #   Do all the hard work
194
    #
195
    my $uref;
196
    if ( $opt_url )
197
    {
198
        $uref = NewSessionByUrl ( $opt_url );
199
        $uref->CalcRmReference($uref->Full());
200
    }
201
    else
202
    {
203
        $uref = NewSessionByWS($opt_path, 0, 1);
204
        my $ws_root = $uref->SvnLocateWsRoot(1);
205
        $uref->CalcRmReference($uref->FullWs());
206
    }
207
 
1348 dpurdie 208
    Message ("Tag is  : " . $uref->RmRef() );
209
    Message ("Vcs Tag : " . $uref->SvnTag  );
210
 
369 dpurdie 211
    $opr_done = 1;
212
}
213
#-------------------------------------------------------------------------------
214
# Function        : ShowUrl
215
#
216
# Description     : Convert a TAG into a URL
217
#                   Show the current workspace URL
218
#
219
# Inputs          : tag                     - Tag to convert (optional)
220
#                   Options
221
#                       -help[=n]           - Show help
222
#                       -man                - Show manual
223
#                       -tag=tag            - Convert TAG
224
#                       -path=path          - Convert Workspace
225
#
226
# Returns         : Nothing
227
#
228
sub ShowUrl
229
{
230
    my $opt_path;
231
    my $opt_tag;
232
 
233
    #
234
    #   Parse more options
235
    #
236
    GetOptions (
237
                "help:+"        => \$opt_help,
238
                "manual:3"      => \$opt_help,
239
                "path:s"        => \$opt_path,
240
                "tag:s"         => \$opt_tag,
241
                ) || Error ("Invalid command line" );
242
 
243
    #
244
    #   Subcommand specific help
245
    #
246
    SubCommandHelp( $opt_help, "Tag to Url") if ($opt_help);
247
 
248
    #
249
    #   Bare argument is a TAG
250
    #   If no arguments provided assume a path of the current directory
251
    #
252
    $opt_tag = shift (@ARGV) if ( $#ARGV == 0 );
253
    $opt_path = '.' unless ( defined $opt_path || defined $opt_tag );
254
 
255
    #
256
    #   Sanity Tests
257
    #
258
    Error ("Cannot specify both a TAG and a PATH")
259
            if ( defined $opt_tag && defined $opt_path );
260
    Warning ("Too many arguments") if ( $#ARGV >= 0 );
261
 
262
    #   Do all the hard work
263
    #
264
    my $uref;
265
    my $url;
266
    if ( $opt_tag )
267
    {
268
        $url = SvnPath2Url($opt_tag);
269
    }
270
    else
271
    {
272
        $uref = NewSessionByWS($opt_path, 0, 1);
273
        my $ws_root = $uref->SvnLocateWsRoot(1);
274
        $url = $uref->FullWsRev();
275
    }
276
 
277
    Message ("Url: $url");
278
    $opr_done = 1;
279
}
280
 
281
#-------------------------------------------------------------------------------
363 dpurdie 282
# Function        : TestSvn
283
#
284
# Description     : Test access to subversion
285
#
286
# Inputs          : None
287
#
288
# Returns         :
289
#
290
sub TestSvn
291
{
292
    #
293
    #   Parse more options
294
    #
295
    GetOptions (
296
                "help:+"        => \$opt_help,
297
                "manual:3"      => \$opt_help,
298
                ) || Error ("Invalid command line" );
299
 
300
    #
301
    #   Subcommand specific help
302
    #
303
    SubCommandHelp( $opt_help, "Test Subversion") if ($opt_help || $#ARGV >= 0);
304
 
305
    SvnUserCmd( '--version');
306
    $opr_done = 1;
307
}
308
 
309
 
310
#-------------------------------------------------------------------------------
311 dpurdie 311
# Function        : SvnRepoCmd
312
#
313
# Description     : Execute a SVN command, where the first argument
314
#                   is a repository specifier
315
#
316
# Inputs          : $cmd
317
#                   $repo_url
318
#                   @opts
319
#
320
# Returns         : 
321
#
322
sub SvnRepoCmd
323
{
324
    my ( $cmd, $repo_url, @opts ) = @_;
325
    my $uref = NewSessionByUrl ( $repo_url );
326
 
327
    SvnUserCmd( $cmd,
328
            $uref->Full,
329
            @opts,
330
            { 'credentials' => 1 });
331
 
332
    $opr_done = 1;
333
}
334
 
335
#-------------------------------------------------------------------------------
336
# Function        : DeletePackage
337
#
338
# Description     : Delete a Package structure within a Repository
339
#                   Intended for test usage
340
#
341
# Inputs          : URL                 - Url to Repo + Package Base
342
#
343
# Returns         : 
344
#
345
sub DeletePackage
346
{
379 dpurdie 347
    my $opt_error = 0;
311 dpurdie 348
    #
349
    #   Parse more options
350
    #
351
    GetOptions (
352
                "help:+"        => \$opt_help,
353
                "manual:3"      => \$opt_help,
379 dpurdie 354
                "error!"       => \$opt_error,
311 dpurdie 355
                ) || Error ("Invalid command line" );
356
 
357
    #
358
    #   Subcommand specific help
359
    #
360
    SubCommandHelp( $opt_help, "Delete a Package") if ($opt_help || $#ARGV < 0);
361
 
362
    #
363
    #   Sanity Tests
364
    #
365
    Message ("Delete Entire Package Tree" );
366
    Warning ("Too many arguments: @ARGV") if ( $#ARGV >= 1 );
367
 
368
    #
369
    #   Do all the hard work
370
    #       Create
371
    #       Import
372
    #       Label
373
    #
374
    my $uref = NewSessionByUrl ( $ARGV[0] );
379 dpurdie 375
    $uref->SvnValidatePackageRoot(!$opt_error);
311 dpurdie 376
    $uref->SvnDelete (
377
                      'target'      => $uref->Full,
385 dpurdie 378
                      'comment'   => [$uref->Path().": Delete Package",'Deleted by user command: jats svn delete-package'],
379 dpurdie 379
                      'noerror'   => !$opt_error,
311 dpurdie 380
                      );
381
    $opr_done = 1;
382
}
383
 
384
#-------------------------------------------------------------------------------
385
# Function        : CreatePackage
386
#
387
# Description     : Create a Package structure within a Repository
388
#                   Optionally Import Data
389
#                   Optionally Tag the import
390
#                   Optionally Tag the import on a branch
391
#
392
# Inputs          : URL                 - Url to Repo + Package Base
393
#                   Options             - Command modifiers
394
#                       -import=path    - Import named directory
395
#                       -label=name     - Label the result
396
#                       -tag=name       - Import to Tag Only
397
#                       -branch=name    - Import to Branch only
398
#                       -new            - Must be new package
399
#                       -replace        - Replace existing
400
#
401
# Returns         : 
402
#
403
sub CreatePackage
404
{
405
    my $opt_import;
406
    my $opt_tag;
407
    my $opt_branch;
408
    my $opt_trunk;
409
    my $opt_new;
410
    my $opt_label;
411
    my $opt_replace;
412
    my $pname;
413
    my $type;
385 dpurdie 414
    my $opt_author;
415
    my $opt_date;
311 dpurdie 416
 
417
 
418
    Message ("Create New Package Version" );
419
 
420
    #
421
    #   Parse more options
422
    #
423
    GetOptions (
424
                "help:+"        => \$opt_help,
425
                "manual:3"      => \$opt_help,
426
                "verbose:+"     => \$opt_verbose,
427
                "import=s"      => \$opt_import,
428
                "new"           => \$opt_new,
429
                "branch=s"      => \$opt_branch,
430
                "trunk"         => \$opt_trunk,
1347 dpurdie 431
                "tags=s"        => \$opt_tag,
311 dpurdie 432
                "label=s"       => \$opt_label,
433
                "replace"       => \$opt_replace,
385 dpurdie 434
                'author=s'      => \$opt_author,
435
                'date=s'        => \$opt_date,
311 dpurdie 436
 
437
                ) || Error ("Invalid command line" );
438
 
439
    #
440
    #   Subcommand specific help
441
    #
442
    SubCommandHelp( $opt_help, "Create a Package Version") if ($opt_help || $#ARGV < 0);
443
 
444
    #
369 dpurdie 445
    #   Alter the error reporting parameters
311 dpurdie 446
    #
447
    ErrorConfig( 'verbose' => $opt_verbose );
448
 
449
    #
450
    #   Sanity Tests
451
    #
452
    my $count = 0;
453
    $count++ if ( $opt_trunk );
454
    $count++ if ( $opt_branch );
455
    $count++ if ( $opt_tag );
456
    Error ("Conflicting options: -trunk, -tag, -branch") if ( $count > 1 );
457
    Error ("Nothing imported to be labeled") if ( $count && !$opt_import );
458
    Error ("Import path does not exist: $opt_import") if ( $opt_import && ! -d $opt_import );
459
    Error ("Conflicting options: new and replace") if ( $opt_new && $opt_replace );
385 dpurdie 460
    Error ("Too many command line arguments") if ( exists $ARGV[1] );
311 dpurdie 461
 
1347 dpurdie 462
    $type = 'tags/' . $opt_tag          if ( $opt_tag);
463
    $type = 'branches/' . $opt_branch   if ( $opt_branch );
464
    $type = 'trunk'                     if ( $opt_trunk);
311 dpurdie 465
 
466
    #
467
    #   Do all the hard work
468
    #       Create
469
    #       Import
470
    #       Label
471
    #
472
    my $uref = NewSessionByUrl ( $ARGV[0] );
473
    $uref->SvnCreatePackage (
474
                      'import'  => $opt_import,
475
                      'label'   => $opt_label,
476
                      'type'    => $type,
477
                      'new'     => $opt_new,
478
                      'replace' => $opt_replace,
479
                      );
385 dpurdie 480
    #
481
    # Report RmPath as using a pegged version of a new package is a bit silly
482
    #
1356 dpurdie 483
#    Message ("Repository Ref: " . $uref->RmPath);
484
#    Message ("Vcs Tag       : " . $uref->SvnTag);
1270 dpurdie 485
    if ( $uref->{REVNO} )
486
    {
487
        $uref->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
488
        $uref->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
489
    }
311 dpurdie 490
    $opr_done = 1;
491
}
492
 
493
#-------------------------------------------------------------------------------
494
# Function        : ImportPackage
495
#
496
# Description     : Import a new version of a package
497
#                   Take great care to reuse file-versions that are already in
498
#                   the  package
499
#
369 dpurdie 500
#                   Intended to allow the importation of multiple
311 dpurdie 501
#                   versions of a package
502
#
503
# Inputs          : 
504
#
505
# Returns         : 
506
#
507
sub ImportPackage
508
{
509
    Message ("Import Package Version" );
510
 
511
    #
512
    #   Options
513
    #
514
    my $opt_package;
515
    my $opt_dir;
516
    my $opt_label;
517
    my $opt_replace = 0;
518
    my $opt_reuse;
519
    my $opt_workdir = "SvnImportDir";
520
    my $opt_delete = 1;
379 dpurdie 521
    my $opt_author;
522
    my $opt_date;
523
    my $opt_log = '';
524
    my $opt_branch;
525
    my $opt_datafile;
1348 dpurdie 526
    my $opt_printfiles;
311 dpurdie 527
 
528
    #
529
    #   Other globals
530
    #
531
    my $url_label;
379 dpurdie 532
    my $url_branch;
311 dpurdie 533
 
534
    #
535
    #   Configuration options
536
    #
537
    my $result = GetOptions (
379 dpurdie 538
                    'help:+'        => \$opt_help,
539
                    'manual:3'      => \$opt_help,
540
                    'verbose:+'     => \$opt_verbose,
541
                    'package=s'     => \$opt_package,
542
                    'dir=s'         => \$opt_dir,
543
                    'label=s'       => \$opt_label,
544
                    'branch=s'      => \$opt_branch,
545
                    'replace'       => \$opt_replace,
546
                    'reuse'         => \$opt_reuse,
547
                    'workspace=s'   => \$opt_workdir,
548
                    'delete!'       => \$opt_delete,
1348 dpurdie 549
                    'printfiles=i'  => \$opt_printfiles,
379 dpurdie 550
                    'author=s'      => \$opt_author,
551
                    'date=s'        => \$opt_date,
552
                    'log=s'         => \$opt_log,
553
                    'datafile=s'    => \$opt_datafile,
311 dpurdie 554
 
555
                    #
556
                    #   Update documentation at the end of the file
557
                    #
558
                    ) || Error ("Invalid command line" );
559
 
560
    #
561
    #   Insert defaults
341 dpurdie 562
    #   User can specify base package via -package or a non-options argument
311 dpurdie 563
    #
564
    $opt_package = $ARGV[0] unless ( $opt_package );
379 dpurdie 565
    unlink $opt_datafile if ( defined $opt_datafile );
311 dpurdie 566
 
567
    #
568
    #   Subcommand specific help
569
    #
570
    SubCommandHelp( $opt_help, "Import directory to a Package")
571
        if ($opt_help || ! $opt_package );
572
 
573
    #
369 dpurdie 574
    #   Alter the error reporting parameters
311 dpurdie 575
    #
576
    ErrorConfig( 'verbose' => $opt_verbose );
577
 
578
    #
579
    #   Configure the error reporting process now that we have the user options
580
    #
581
    Error ("No package URL specified") unless ( $opt_package );
582
    Error ("No base directory specified") unless ( $opt_dir );
583
    Error ("Invalid base directory: $opt_dir") unless ( -d $opt_dir );
584
 
585
    #
586
    #   Create an SVN session
587
    #
588
    my $svn = NewSessionByUrl ( $opt_package );
589
 
590
    #
591
    #   Ensure that the required label is available
592
    #
593
    if ( $opt_label )
594
    {
595
        $opt_label = SvnIsaSimpleLabel ($opt_label);
596
        $url_label = $svn->BranchName( $opt_label, 'tags' );
597
        $svn->SvnValidateTarget (
598
                        'target' => $url_label,
599
                        'available' => 1,
600
                        ) unless ( $opt_replace );
601
    }
602
 
603
    #
379 dpurdie 604
    #   Validate the required branch
605
    #   It will be created if it doesn't exist
606
    #
607
    if ( $opt_branch )
608
    {
609
        $opt_branch = SvnIsaSimpleLabel($opt_branch);
610
        $url_branch = $svn->BranchName( $opt_branch, 'branches' );
385 dpurdie 611
        my $rv = $svn->SvnValidateTarget (
612
                        'cmd'    => 'SvnImporter. Create branch',
379 dpurdie 613
                        'target' => $url_branch,
614
                        'create' => 1,
615
                        );
385 dpurdie 616
        if ( $rv == 2 )
617
        {
618
            $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
619
            $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
620
        }
379 dpurdie 621
    }
622
 
623
    #
311 dpurdie 624
    #   Create a workspace based on the users package
625
    #   Allow the workspace to be reused to speed up multiple
626
    #   operations
627
    #
628
    unless ( $opt_reuse && -d $opt_workdir )
629
    {
630
        Message ("Creating Workspace");
631
        rmtree( $opt_workdir );
632
 
633
        $svn->SvnValidatePackageRoot ();
634
        #DebugDumpData( 'Svn', $svn );
635
        $svn->SvnValidateTarget (
636
                            'cmd'    => 'SvnImporter',
637
                            'target' => $svn->Full,
638
                            'require' => 1,
639
                            );
640
 
379 dpurdie 641
        my $url_co = $opt_branch ? $url_branch : $svn->Full . '/trunk';
1356 dpurdie 642
        $svn->SvnCo ( $url_co, $opt_workdir, 'print' => $opt_printfiles );
311 dpurdie 643
        Error ("Cannot locate the created Workspace")
644
            unless ( -d $opt_workdir );
645
    }
646
    else
647
    {
648
        Message ("Reusing Workspace");
649
    }
650
 
651
    #
652
    #   Determine differences between the two folders
653
    #       Create structures for each directory
654
    #
655
    Message ("Determine Files in packages");
656
 
657
    my $search = JatsLocateFiles->new("--Recurse=1",
658
                                       "--DirsToo",
659
                                       "--FilterOutRe=/\.svn/",
660
                                       "--FilterOutRe=/\.svn\$",
661
                                       "--FilterOutRe=^/${opt_workdir}\$",
662
                                       "--FilterOutRe=^/${opt_workdir}/",
663
                                       );
664
    my @ws = $search->search($opt_workdir);
665
    my @dir = $search->search($opt_dir);
666
 
1270 dpurdie 667
    #
668
    #   Scan for a source file
669
    #   Trying to detect empty views
670
    #   Look for file, not directory
671
    #
672
    {
673
        my $fileFound = 0;
674
        foreach ( @dir )
675
        {
676
            next if ( m~/$~ );
677
            $fileFound++;
678
            last;
679
        }
680
 
681
        unless ( $fileFound )
682
        {
683
            Warning ("No source files found in source view");
684
            $opr_done = 1;
685
            return;
686
        }
687
    }
688
 
311 dpurdie 689
    #Information ("WS Results", @ws);
690
    #Information ("DIR Results", @dir);
1270 dpurdie 691
    #Information ("WS Results: ", scalar @ws);
692
    #Information ("DIR Results:", scalar @dir);
311 dpurdie 693
 
694
    #
695
    #   Create a hash the Workspace and the User dir
696
    #   The key will be file names
697
    #
698
    my %ws;  map ( $ws{$_} = 1 , @ws );
699
    my %dir; map ( $dir{$_} = 1 , @dir );
700
 
701
    #
702
    #   Create a hash of common elements
703
    #   Removing then from the other two
704
    #
705
    my %common;
706
    foreach ( keys %ws )
707
    {
708
        next unless ( exists $dir{$_} );
709
        $common{$_} = 1;
710
        delete $ws{$_};
711
        delete $dir{$_};
712
    }
713
 
714
    #DebugDumpData( 'WS', \%ws );
715
    #DebugDumpData( 'DIR', \%dir );
716
    #DebugDumpData( 'COMMON', \%common );
717
 
718
    #
379 dpurdie 719
    #   Need to consider the case where a file has been replaced with a directory
720
    #   and visa-versa. Delete files and directories first.
721
    #
722
    #
723
    #   Remove files
724
    #   Sort in reverse. This will ensure that we process directory
725
    #   contents before directories
726
    #
727
    my @rm_files = reverse sort keys %ws;
728
    if ( @rm_files )
729
    {
730
        foreach my $file ( @rm_files  )
731
        {
732
            Verbose ("Removing $file");
733
            unlink "$opt_workdir/$file";
734
        }
735
 
736
        #
737
        #   Inform Subversion about the removed files
738
        #
739
        my $base = 0;
740
        my $num = $#rm_files;
741
        Message ("Update the workspace: Removed " . ($num + 1) . " Files");
742
 
743
        while ( $base <= $num )
744
        {
745
            my $end = $base + 200;
746
            $end = $num if ( $end > $num );
747
 
748
            $svn->SvnCmd ( 'delete', map ("$opt_workdir/$_@", @rm_files[$base .. $end] ),
749
                            { 'error' => 'Deleting files from workspace' } );
750
 
751
            $base = $end + 1;
752
        }
753
    }
754
 
755
    #
311 dpurdie 756
    #   Add New Files
757
    #   Won't add empty directories at this point
758
    #
759
    #   Process by sorted list
760
    #   This will ensure we process parent directories first
761
    #
762
    my @added = sort keys %dir;
763
    if ( @added )
764
    {
765
        foreach my $file ( @added  )
766
        {
767
            my $src = "$opt_dir/$file";
768
            my $target = "$opt_workdir/$file";
769
 
770
            if ( -d $src )
771
            {
379 dpurdie 772
                Verbose ("Adding directory: $file");
311 dpurdie 773
                mkdir ( $target ) unless (-d $target);
774
            }
775
            else
776
            {
777
 
778
                my $path = dirname ( $target);
779
                mkdir ( $path ) unless (-d $path);
780
 
781
                Verbose ("Adding $file");
782
                unless (File::Copy::copy( $src, $target ))
783
                {
784
                    Error("Failed to transfer file [$file]: $!");
785
                }
786
            }
787
        }
788
 
789
        #
790
        #   Inform Subversion about the added files
791
        #   The command line does have a finite length, so add them 200 at a
792
        #   time.
793
        #
794
 
795
        my $base = 0;
796
        my $num = $#added;
379 dpurdie 797
        Message ("Update the workspace: Added " . (1 + $num) . " files");
311 dpurdie 798
 
799
        while ( $base <= $num )
800
        {
801
            my $end = $base + 200;
802
            $end = $num if ( $end > $num );
803
 
804
            $svn->SvnCmd ( 'add'
805
                            , '--depth=empty'
806
                            , '--parents'
379 dpurdie 807
                            , map ("$opt_workdir/$_@", @added[$base .. $end] ),
311 dpurdie 808
                            { 'error' => 'Adding files to workspace' } );
809
 
810
            $base = $end + 1;
811
        }
812
    }
813
 
814
    #
815
    #   The common files may have changed
816
    #   Simply copy them all in and let subversion figure it out
817
    #
818
    foreach my $file ( sort keys %common  )
819
    {
820
        my $src = "$opt_dir/$file";
821
        my $target = "$opt_workdir/$file";
822
 
823
        next if ( -d $src );
824
        if ( File::Compare::compare ($src, $target) )
825
        {
826
            Verbose ("Transfer $file");
827
            unlink $target;
828
            unless (File::Copy::copy( $src, $target ))
829
            {
830
                Error("Failed to transfer file [$file]: $!",
831
                      "Src: $src",
832
                      "Tgt: $target");
833
            }
834
        }
835
    }
836
 
837
    #
838
    #   Commit the workspace
839
    #   This will go back onto the trunk
840
    #
841
    $svn = NewSessionByWS( $opt_workdir );
379 dpurdie 842
    my $pkgPath = $svn->Path();
387 dpurdie 843
 
379 dpurdie 844
    my $ciComment = "$pkgPath: Checkin by Svn Import";
845
    $ciComment .= "\n" . $opt_log if ( $opt_log );
846
    $ciComment =~ s~\r\n~\n~g;
387 dpurdie 847
    $ciComment =~ s~\r~\n~g;
848
    $ciComment = encode('UTF-8', $ciComment, Encode::FB_DEFAULT);
849
 
379 dpurdie 850
    $svn->SvnCi ('comment' => $ciComment, 'allowSame' => 1 );
381 dpurdie 851
    Message ("Repository Ref: " . $svn->RmRef) unless( $opt_label );
379 dpurdie 852
    $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
853
    $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
311 dpurdie 854
 
855
    #
856
    #   Label the result
857
    #   The workspace will have been updated, so we can use it as the base for
858
    #   the labeling process
859
    #
860
    if ( $opt_label )
861
    {
862
        $svn->SvnCopyWs (
863
                       target => $url_label,
864
                       'noswitch' => 1,
865
                       'replace' => $opt_replace,
379 dpurdie 866
                       'comment' => "$pkgPath: Tagged by Jats Svn Import",
311 dpurdie 867
                       );
868
        Message ("Repository Ref: " . $svn->RmRef);
1347 dpurdie 869
        Message ("Vcs Tag       : " . $svn->SvnTag);
379 dpurdie 870
        $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
871
        $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
311 dpurdie 872
    }
873
 
874
    #
875
    #   Clean up
876
    #
877
    if ( $opt_delete && ! $opt_reuse )
878
    {
879
        Message ("Delete Workspace");
880
        rmtree( $opt_workdir );
881
    }
379 dpurdie 882
 
883
    #
884
    #   Automation data transfer
885
    #
886
    if ( defined $opt_datafile )
887
    {
888
        my $data = JatsProperties::New();
889
 
890
        $data->setProperty('Command'        , 'ImportPackage');
891
        $data->setProperty('Label'          , $opt_label);
1347 dpurdie 892
        $data->setProperty('subversion.url' , $svn->RmRef);
893
        $data->setProperty('subversion.tag' , $svn->SvnTag);
379 dpurdie 894
 
895
        $data->Dump('InfoFile') if ($opt_verbose);
896
        $data->store( $opt_datafile );
897
    }
898
 
311 dpurdie 899
    $opr_done = 1;
900
}
901
 
902
#-------------------------------------------------------------------------------
385 dpurdie 903
# Function        : DeleteBranch
904
#
905
# Description     : Delete the branch that a workspace is based upon
906
#
907
# Inputs          : 
908
#
909
# Returns         : 
910
#
911
sub DeleteBranch
912
{
913
    my $opt_path;
914
    my $opt_error = 0;
915
    #
916
    #   Parse more options
917
    #
918
    GetOptions (
919
                "help:+"        => \$opt_help,
920
                "manual:3"      => \$opt_help,
921
                "path:s"        => \$opt_path,
922
                ) || Error ("Invalid command line" );
923
 
924
    #
925
    #   Subcommand specific help
926
    #
927
    SubCommandHelp( $opt_help, "Delete Branch") if ($opt_help);
928
 
929
    #
930
    #   Sanity Tests
931
    #
932
    Message ("Delete Workspace Branch" );
933
    Error ("Too many arguments: @ARGV") if ( $#ARGV >= 0 );
934
 
935
    #
936
    #   Do all the hard work
937
    #
938
    $opt_path = '.' unless ( defined $opt_path );
939
    my $uref = NewSessionByWS($opt_path, 0, 1);
940
    my $ws_root = $uref->SvnLocateWsRoot(1);
941
    my $ws_url = $uref->FullWs();
942
 
943
    #
944
    #   Must be a branch
945
    #
946
    Error ("Workspace is not based on a branch")
947
        unless ( $ws_url =~ m ~/branches/~ );
948
 
949
    Message ("Deleting: " . $uref->{WSURL} );
950
    $uref->SvnDelete (
951
                      'target'    => $ws_url,
952
                      'comment'   => [$uref->Path().": Delete Branch",'Deleted by user command: jats svn delete-branch'],
953
                      );
954
    $opr_done = 1;
955
}
956
 
957
 
958
#-------------------------------------------------------------------------------
311 dpurdie 959
# Function        : SubCommandHelp
960
#
961
# Description     : Provide help on a subcommand
962
#
963
# Inputs          : $help_level             - Help Level 1,2,3
964
#                   $topic                  - Topic Name
965
#
966
# Returns         : This function does not return
967
#
968
sub SubCommandHelp
969
{
970
    my ($help_level, $topic) = @_;
971
    my @sections;
972
    #
973
    #   Spell out the section we want to display
974
    #
975
    #   Note:
976
    #   Due to bug in pod2usage can't use 'head1' by itself
977
    #   Each one needs a subsection.
978
    #
979
    push @sections, qw( NAME SYNOPSIS ) ;
980
    push @sections, qw( ARGUMENTS OPTIONS ) if ( $help_level > 1 );
981
    push @sections, qw( DESCRIPTION )       if ( $help_level > 2 );
982
 
983
    #
984
    #   Extract section from the POD
985
    #
986
    pod2usage({-verbose => 99,
987
               -noperldoc => 1,
988
               -sections => $topic . '/' . join('|', @sections) } );
989
}
990
 
991
 
992
 
993
#-------------------------------------------------------------------------------
994
#   Documentation
995
#   NOTE
996
#
997
#   Each subcommand MUST have
998
#   head1 section as used by the subcommand
999
#       This should be empty, as the contents will NOT be displayed
1000
#   head2 sections called
1001
#       NAME SYNOPSIS ARGUMENTS OPTIONS DESCRIPTION
1002
#
1003
#=head1 xxxxxx
1004
#=head2 NAME
1005
#=head2 SYNOPSIS
1006
#=head2 ARGUMENTS
1007
#=head2 OPTIONS
1008
#=head2 DESCRIPTION
1009
#
1010
 
1011
=pod
1012
 
361 dpurdie 1013
=for htmltoc    GENERAL::Subversion::
1014
 
311 dpurdie 1015
=head1 NAME
1016
 
1017
jats svn - Miscellaneous SubVersion Operations
1018
 
1019
=head1 SYNOPSIS
1020
 
1021
jats svn [options] command [command options]
1022
 
1023
 Options:
1024
    -help[=n]              - Help message, [n=1,2,3]
1025
    -man                   - Full documentation [-help=3]
1026
    -verbose[=n]           - Verbose command operation
1027
 
1028
 Common Command Options:
1029
    All command support suboptions to provide command specific help
1030
 
1031
    -help[=n]              - Help message, [n=1,2,3]
1032
    -man                   - Full documentation [-help=3]
1033
 
1034
 Commands are:
363 dpurdie 1035
    test                   - Test access to subversion
369 dpurdie 1036
    paths                  - Display Subversion tag to URL conversions
311 dpurdie 1037
    ls URL                 - List Repo contents for URL
369 dpurdie 1038
    tag [URL]              - Convert URL or Path to a Release Manager Tag
1039
    url [TAG]              - Convert TAG or Path to a Subversion URL
311 dpurdie 1040
    delete-package URL     - Delete Package Subtree
385 dpurdie 1041
    delete-branch          - Delete a Development Branch
311 dpurdie 1042
    create URL             - Create a new package at URL
1043
    import URL             - Import files to package at URL
1044
 
1045
 Use the command
1046
    jats svn command -h
1047
 for command specific help
1048
 
1049
 
1050
=head1 OPTIONS
1051
 
1052
=over
1053
 
1054
=item B<-help[=n]>
1055
 
1056
Print a help message and exit. The level of help may be either 1, 2 or
1057
3 for a full manual.
1058
 
1059
This option may be specified multiple times to increment the help level, or
1060
the help level may be directly specified as a number.
1061
 
1062
=item B<-man>
1063
 
1064
This is the same as '-help=3'.
1065
The complete help is produced in a man page format.
1066
 
1067
=item B<--verbose[=n]>
1068
 
1069
This option will increase the level of verbosity of the commands.
1070
 
1071
If an argument is provided, then it will be used to set the level, otherwise the
1072
existing level will be incremented. This option may be specified multiple times.
1073
 
1074
=back
1075
 
1076
=head1 DESCRIPTION
1077
 
1078
This program provides a number of useful Subversion based operations.
1079
 
363 dpurdie 1080
=head1 Test Subversion
1081
 
1082
=head2 NAME
1083
 
1084
Test Subversion
1085
 
1086
=head2 SYNOPSIS
1087
 
1088
    jats svn test
1089
 
1090
=head2 DESCRIPTION
1091
 
1092
This command will ensure that the subversion command line utility can be
1093
located. The command will report the version of the svn client found.
1094
 
369 dpurdie 1095
=head1 Subversion Paths
1096
 
1097
=head2 NAME
1098
 
1099
Subversion Paths
1100
 
1101
=head2 SYNOPSIS
1102
 
1103
    jats svn paths
1104
 
1105
=head2 DESCRIPTION
1106
 
1107
This command will display the base Tags and associated URLs that are used by
1108
JATS to convert a 'Subversion Tag' into a full URLs that will be used to access
1109
a physical repository.
1110
 
1111
The 'Tags' configuration is site-specific.
1112
 
311 dpurdie 1113
=head1 List Repository
1114
 
363 dpurdie 1115
=head2 NAME
1116
 
1117
List Repository
1118
 
1119
=head2 SYNOPSIS
1120
 
1121
    jats svn ls <URL>
1122
 
1123
=head2 DESCRIPTION
1124
 
311 dpurdie 1125
This command will take a URL and perform a 'svn' list operation. The URL will
1126
be expanded to include the site specific repository.
1127
 
369 dpurdie 1128
=head1 Url to Tag
1129
 
1130
=head2 NAME
1131
 
1132
Url to Tag
1133
 
1134
=head2 SYNOPSIS
1135
 
1136
    jats svn tag [Option] [tag]
1137
 
1138
 Options:
1139
    -help[=n]              - Help message, [n=1,2,3]
1140
    -man                   - Full documentation [-help=3]
1141
    -path=path             - Convert specified path
1142
    -url=url               - Convert specified URL
1143
 
1144
=head2 DESCRIPTION
1145
 
1146
This command will convert a URL or a PATH to a Subversion Tag that can
1147
be used within the remainder of the build system. If no PATH or URL is provided,
1148
then the command uses a path of the current directory.
1149
 
1150
The command will convert either a PATH or a URL. It will not do both.
1151
 
1152
The command will use the configured Subversion URL prefixes to create the Tag.
1153
 
1154
If a PATH is to be converted, then the PATH must address a Subversion workspace.
1155
The conversion will return a Tag to the root of the Workspace and Peg it to
1156
the last committed version. The command will not determine if the workspace
1157
contains modified files.
1158
 
1159
If a URL is to be converted, then the resultant value should be used with
1160
caution. The result is only as good as the provided URL and may not address
1161
the root of a package.
1162
 
1163
=head1 Tag to Url
1164
 
1165
=head2 NAME
1166
 
1167
Tag to Url
1168
 
1169
=head2 SYNOPSIS
1170
 
1171
    jats svn url [Option] [url]
1172
 
1173
 Options:
1174
    -help[=n]              - Help message, [n=1,2,3]
1175
    -man                   - Full documentation [-help=3]
1176
    -path=path             - Convert specified path
1177
    -url=url               - Convert specified URL
1178
 
1179
=head2 DESCRIPTION
1180
 
1181
This command will convert a TAG or a PATH to a full URL that can be used
1182
directly by Subversion. If no PATH or TAG is provided, then the command uses a
1183
path of the current directory.
1184
 
1185
The command will convert either a TAG or a URL. It will not do both.
1186
 
1187
The command will use the configured Subversion URL prefixes to expand the TAG.
1188
 
1189
If a PATH is to be converted, then the PATH must address a Subversion workspace.
1190
The conversion will return a URL to the root of the Workspace and Peg it to
1191
the last committed version. The command will not determine if the workspace
1192
contains modified files.
1193
 
1194
If a TAG is to be converted, then the resultant value should be used with
1195
caution. The result is only as good as the provided URL and may not address
1196
the root of a package.
1197
 
311 dpurdie 1198
=head1 Delete a Package
1199
 
1200
=head2 NAME
1201
 
1202
Delete a Package
1203
 
1204
=head2 SYNOPSIS
1205
 
1206
jats svn delete-package URL [options]
1207
 
1208
 Options:
1209
    -help[=n]              - Help message, [n=1,2,3]
1210
    -man                   - Full documentation [-help=3]
1211
    -verbose[=n]           - Verbose command operation
1212
 
1213
=head2 ARGUMENTS
1214
 
1215
The command takes one argument: The URL of the desired package.
1216
This may be be:
1217
 
1218
=over
1219
 
1220
=item * A full URL
1221
 
1222
Complete with protocol and path information.
1223
 
1224
=item * A simple URL
1225
 
1226
JATS will prepend the site-specific repository location to the user provided URL
1227
 
1228
=back
1229
 
1230
=head2 OPTIONS
1231
 
1232
This command has no significant options, other than the general help options.
1233
 
1234
=head2 DESCRIPTION
1235
 
1236
This command will delete a package from the repository. It will ensure
1237
that the package is a valid package, before it is deleted.
1238
 
1239
The command is intended to be used by test scripts, rather than users.
1240
 
385 dpurdie 1241
=head1 Delete Branch
1242
 
1243
=head2 NAME
1244
 
1245
Delete the Workspace Branch
1246
 
1247
=head2 SYNOPSIS
1248
 
1249
jats svn delete-branch [options]
1250
 
1251
 Options:
1252
    -help[=n]              - Help message, [n=1,2,3]
1253
    -man                   - Full documentation [-help=3]
1254
    -verbose[=n]           - Verbose command operation
1255
    -path=path             - Target workspace
1256
 
1257
=head2 ARGUMENTS
1258
 
1259
The command takes no arguments.
1260
 
1261
=head2 OPTIONS
1262
 
1263
=over
1264
 
1265
=item B<-path=path>
1266
 
1267
This options specifies the path of the target workspace. If not provided the
1268
command will use the current directory.
1269
 
1270
=back
1271
 
1272
=head2 DESCRIPTION
1273
 
1274
This command will delete the branch associated with the workspace in the
1275
specified path. It is intended to simplify the deletion of Private or
1276
Development branches.
1277
 
1278
If the workspace is not linked to a 'branch' then the command will fail.
1279
 
311 dpurdie 1280
=head1 Create a Package Version
1281
 
1282
=head2 NAME
1283
 
1284
Create a Package Version
1285
 
1286
=head2 SYNOPSIS
1287
 
1288
jats svn [options] create URL [command options]
1289
 
1290
 Options:
1291
    -help[=n]               - Help message, [n=1,2,3]
1292
    -man                    - Full documentation [-help=3]
1293
    -verbose[=n]            - Verbose command operation
1294
 
1295
 Command Options
1296
    -help[=n]               - Provide command specific help
1297
    -new                    - Package must not exist
1298
    -replace                - Replace any existing versions
1356 dpurdie 1299
    -import=nnn             - Import directory tree
1300
    -label=nnn              - Label imported package
1301
    -trunk                  - Import to trunk (default)
311 dpurdie 1302
    -tags=nnn               - Import to tags
1303
    -branch=nnn             - Import to branches
1304
 
1305
=head2 ARGUMENTS
1306
 
1307
The command takes one argument: The URL of the desired package.
1308
This may be be:
1309
 
1310
=over
1311
 
1312
=item * A full URL
1313
 
1314
Complete with protocol and path information.
1315
 
1316
=item * A simple URL
1317
 
1318
JATS will prepend the site-specific repository location to the user provided URL
1319
 
1320
=back
1321
 
1322
=head2 OPTIONS
1323
 
1324
=over
1325
 
1326
=item -help[=n]
1327
 
1328
Print a help message and exit. The level of help may be either 1, 2 or 3.
1329
 
1330
This option may be specified multiple times to increment the help level, or
1331
the help level may be directly specified as a number.
1332
 
1333
=item -new
1334
 
1335
This option specifies that the named package MUST not exist at all.
1336
 
1337
=item -replace
1338
 
1339
This option allows the program to replace any existing versions of the
1340
imported source. It will allow the deletion of any existing trunk, tags or
1341
branches.
1342
 
1356 dpurdie 1343
=item -import=nnn
1344
 
1345
This option specifies the path of a subdirectory tree to import into the newly
1346
created package. In not provided, then only a package skeleton will be created.
1347
 
1348
=item -label=nnn
1349
 
1350
This option specifies a label to place the imported source.
1351
 
311 dpurdie 1352
=item -trunk
1353
 
1354
This option specifies that imported source will be placed on the trunk of the
1355
package. This is the default mode of import.
1356
 
1357
The options -trunk, -tags and -branch are mutually exclusive.
1358
 
1359
=item -tags=nnn
1360
 
1361
This option specifies that imported source will be placed directly on the
1362
named tag of the package.
1363
 
1364
The options -trunk, -tags and -branch are mutually exclusive.
1365
 
1366
=item -branch=nnn
1367
 
1368
This option specifies that imported source will be placed directly on the
1369
named branch of the package.
1370
 
1371
The options -trunk, -tags and -branch are mutually exclusive.
1372
 
1373
=back
1374
 
1375
=head2 DESCRIPTION
1376
 
1377
This command will create a new package within a repository. It will ensure
1378
that the package contains the three required subdirectories: trunk, tags and
1379
branches.
1380
 
1381
The command will also ensure that packages are not placed at inappropriate
1382
locations within the repository. It is not correct to place a package within
1383
another package.
1384
 
1385
The command will, optionally, import a directory tree into the repository and,
1386
optionally, label the package.
1387
 
1388
The package body may be imported to the 'trunk' or to a branch or a tag.
1389
By default the data will be imported to the trunk and may be labeled (tagged).
1390
 
1391
Options allow the targets to be deleted if they exist or to ensure that they
1392
are not present.
1393
 
1394
The command does not attempt to merge file versions within the repository. It
1395
may result in multiple instances of a file within the repository. Use only for
341 dpurdie 1396
simple imports. Use the 'import' command for more sophisticated import requirements.
311 dpurdie 1397
 
1398
=head1 Import directory to a Package
1399
 
1400
=head2 NAME
1401
 
1402
Import directory to a Package
1403
 
1404
=head2 SYNOPSIS
1405
 
1406
jats svn [options] import URL [command options]
1407
 
1408
 Options:
1409
    -help[=n]               - Help message, [n=1,2,3]
1410
    -man                    - Full documentation [-help=3]
1411
    -verbose[=n]            - Verbose command operation
1412
 
1413
 Command Options
1414
    -help[=n]               - Command specific help, [n=1,2,3]
1415
    -verbose[=n]            - Verbose operation
1416
    -package=name           - Name of source package
1417
    -dir=path               - Path to new version
379 dpurdie 1418
    -label=label            - Label the result
1419
    -branch=branchName      - Base import on a branch
311 dpurdie 1420
    -replace                - Allow the label to be replaced
1421
    -reuse                  - Reuse the import directory
1422
    -workspace=path         - Path and name of alternate workspace
1423
    -[no]delete             - Deletes workspace after use. Default:yes
379 dpurdie 1424
    -author=name            - Force author of changes
1425
    -date=dateString        - Force date of changes
1426
    -log=text               - Append text to the commit message
1427
    -datafile=path          - Export tag data for automation
311 dpurdie 1428
 
379 dpurdie 1429
 
311 dpurdie 1430
=head2 ARGUMENTS
1431
 
1432
The command takes one argument: The URL of the desired package.
1433
This may be be:
1434
 
1435
=over
1436
 
1437
=item * A full URL
1438
 
1439
Complete with protocol and path information.
1440
 
1441
=item * A simple URL
1442
 
1443
JATS will prepend the site-specific repository location to the user provided URL
1444
 
1445
=back
1446
 
1447
=head2 OPTIONS
1448
 
1449
=over
1450
 
1451
=item -help[=n]
1452
 
1453
Print a help message and exit. The level of help may be either 1, 2 or 3.
1454
 
1455
This option may be specified multiple times to increment the help level, or
1456
the help level may be directly specified as a number.
1457
 
1458
=item -verbose[=n]
1459
 
1460
This option will increase the level of verbosity of the utility.
1461
 
1462
If an argument is provided, then it will be used to set the level, otherwise the
1463
existing level will be incremented. This option may be specified multiple times.
1464
 
1465
 
1466
=item -package=name
1467
 
1468
Either this option or a bare URL on the command line must be provided. It
1469
specifies the repository and package to be used as a basis for the work.
1470
 
1471
=item -dir=path
1472
 
1473
This option is mandatory. It specifies the path to a local directory that
1474
contains a version of the software to be checked in.
1475
 
1476
=item -label=name
1477
 
1478
The resulting software version will be labeled with this tag, if it is provided.
1479
 
383 dpurdie 1480
A label name of TIMESTAMP will be treated in special manner. The name will be
1481
replaced with a unique name based on the users name and the current date time.
1482
 
379 dpurdie 1483
=item -branch=branchName
1484
 
1485
This option will cause the importation to be referenced to the named branch.
1486
If the branch does not exist it will be created. If it does exist then it will
1487
be used.
1488
 
1489
If this option is not specified, then the importation will be based on the 'trunk'.
1490
 
1491
If the Workspace is provided, then it will be used independently of this option.
1492
 
383 dpurdie 1493
A branchName of TIMESTAMP will be treated in special manner. The name will be
1494
replaced with a unique name based on the users name and the current date time.
1495
 
311 dpurdie 1496
=item -replace
1497
 
1498
This option, if provided, allows the label to be replaced.
1499
 
1500
=item -reuse
1501
 
1502
This option can be used to speed the creation of multiple versions in a scripted
1503
environment. The option allows the utility to reuse the workspace if it exists.
1504
 
1505
=item -workspace=path
1506
 
1507
This option specifies an alternate workspace directory to create and use. The
1508
default directory is "SvnImportDir" within the users current directory.
1509
 
1510
=item [no]delete
1511
 
341 dpurdie 1512
This option control the deletion of the workspace directory. By default the
311 dpurdie 1513
directory will be deleted, unless re-use is also used.
1514
 
379 dpurdie 1515
=item -author=name
1516
 
1517
This option will force the author of changes as recorded in the repository.
385 dpurdie 1518
The repository must be configured to allow such changes.
379 dpurdie 1519
 
1520
This option may not work for non-admin users.
1521
 
1522
=item -date=dateString
1523
 
1524
This option will force the date of the changes as recorded in the repository.
385 dpurdie 1525
The repository must be configured to allow such changes.
379 dpurdie 1526
The dateString is in a restricted ISO 8601 format: ie 2009-02-12T00:44:04.921324Z
1527
 
1528
This option may not work for non-admin users.
1529
 
1530
=item -log=text
1531
 
1532
This option will append the specified text to the commit message.
1533
The first line of the commit message is fixed by the import tool.
1534
 
1535
=item -datafile=path
1536
 
1537
This option will cause the utility to create a data file to record the import
1538
tag. It is used for automation of the import process.
1539
 
311 dpurdie 1540
=back
1541
 
1542
=head2 DESCRIPTION
1543
 
1544
Import a new version of a package to the trunk of the package. The utility
1545
will only import changed files so that file history is preserved within the
1546
repository.
1547
 
1548
This utility is used import software from another version control system
1549
The utility will:
1550
 
1551
=over
1552
 
361 dpurdie 1553
=item *
311 dpurdie 1554
 
361 dpurdie 1555
Create a Work Space based on the current package version
1556
 
379 dpurdie 1557
The 'trunk' of the named package will be used as the base for the workspace,
1558
unless modified with the -branch option.
311 dpurdie 1559
 
361 dpurdie 1560
=item *
311 dpurdie 1561
 
361 dpurdie 1562
Update files and directories
1563
 
311 dpurdie 1564
Determines the files and directories that have been added and deleted and
1565
update the Workspace to reflect the new structure.
1566
 
361 dpurdie 1567
=item *
311 dpurdie 1568
 
361 dpurdie 1569
Check in the new version
311 dpurdie 1570
 
361 dpurdie 1571
=item *
1572
 
1573
Label the new version
1574
 
311 dpurdie 1575
=back
1576
 
1577
=cut
1578