Subversion Repositories DevTools

Rev

Rev 383 | Rev 387 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 383 Rev 385
Line 87... Line 87...
87
#   Process command
87
#   Process command
88
#   First command line argument is a subversion command
88
#   First command line argument is a subversion command
89
#
89
#
90
my $cmd = shift @ARGV || "help";
90
my $cmd = shift @ARGV || "help";
91
CreatePackage()                        if ( $cmd =~ m/^create/ );
91
CreatePackage()                        if ( $cmd =~ m/^create/ );
-
 
92
DeleteBranch()                         if ( $cmd =~ m/^delete-branch/ );
92
DeletePackage()                        if ( $cmd =~ m/^delete-package/ );
93
DeletePackage()                        if ( $cmd =~ m/^delete-package/ );
93
ImportPackage()                        if ( $cmd =~ m/^import/ );
94
ImportPackage()                        if ( $cmd =~ m/^import/ );
94
SvnRepoCmd($cmd, @ARGV)                if ( $cmd eq 'ls' );
95
SvnRepoCmd($cmd, @ARGV)                if ( $cmd eq 'ls' );
95
TestSvn()                              if ($cmd eq 'test');
96
TestSvn()                              if ($cmd eq 'test');
96
ShowPaths()                            if ( $cmd =~ m/^path/ );
97
ShowPaths()                            if ( $cmd =~ m/^path/ );
Line 369... Line 370...
369
    #
370
    #
370
    my $uref = NewSessionByUrl ( $ARGV[0] );
371
    my $uref = NewSessionByUrl ( $ARGV[0] );
371
    $uref->SvnValidatePackageRoot(!$opt_error);
372
    $uref->SvnValidatePackageRoot(!$opt_error);
372
    $uref->SvnDelete (
373
    $uref->SvnDelete (
373
                      'target'      => $uref->Full,
374
                      'target'      => $uref->Full,
374
                      'comment'   => [$uref->Path().": Delete Pakage",'Deleted by user command','jats svn delete-package'],
375
                      'comment'   => [$uref->Path().": Delete Package",'Deleted by user command: jats svn delete-package'],
375
                      'noerror'   => !$opt_error,
376
                      'noerror'   => !$opt_error,
376
                      );
377
                      );
377
    $opr_done = 1;
378
    $opr_done = 1;
378
}
379
}
379
 
380
 
Line 405... Line 406...
405
    my $opt_new;
406
    my $opt_new;
406
    my $opt_label;
407
    my $opt_label;
407
    my $opt_replace;
408
    my $opt_replace;
408
    my $pname;
409
    my $pname;
409
    my $type;
410
    my $type;
-
 
411
    my $opt_author;
-
 
412
    my $opt_date;
410
 
413
 
411
 
414
 
412
    Message ("Create New Package Version" );
415
    Message ("Create New Package Version" );
413
 
416
 
414
    #
417
    #
Line 423... Line 426...
423
                "branch=s"      => \$opt_branch,
426
                "branch=s"      => \$opt_branch,
424
                "trunk"         => \$opt_trunk,
427
                "trunk"         => \$opt_trunk,
425
                "tag=s"         => \$opt_tag,
428
                "tag=s"         => \$opt_tag,
426
                "label=s"       => \$opt_label,
429
                "label=s"       => \$opt_label,
427
                "replace"       => \$opt_replace,
430
                "replace"       => \$opt_replace,
-
 
431
                'author=s'      => \$opt_author,
-
 
432
                'date=s'        => \$opt_date,
428
 
433
 
429
                ) || Error ("Invalid command line" );
434
                ) || Error ("Invalid command line" );
430
 
435
 
431
    #
436
    #
432
    #   Subcommand specific help
437
    #   Subcommand specific help
Line 447... Line 452...
447
    $count++ if ( $opt_tag );
452
    $count++ if ( $opt_tag );
448
    Error ("Conflicting options: -trunk, -tag, -branch") if ( $count > 1 );
453
    Error ("Conflicting options: -trunk, -tag, -branch") if ( $count > 1 );
449
    Error ("Nothing imported to be labeled") if ( $count && !$opt_import );
454
    Error ("Nothing imported to be labeled") if ( $count && !$opt_import );
450
    Error ("Import path does not exist: $opt_import") if ( $opt_import && ! -d $opt_import );
455
    Error ("Import path does not exist: $opt_import") if ( $opt_import && ! -d $opt_import );
451
    Error ("Conflicting options: new and replace") if ( $opt_new && $opt_replace );
456
    Error ("Conflicting options: new and replace") if ( $opt_new && $opt_replace );
-
 
457
    Error ("Too many command line arguments") if ( exists $ARGV[1] );
452
 
458
 
453
    ($type, $opt_label) = ('tags', $opt_tag)            if ( $opt_tag);
459
    ($type, $opt_label) = ('tags', $opt_tag)            if ( $opt_tag);
454
    ($type, $opt_label) = ('branches', $opt_branch)     if ( $opt_branch );
460
    ($type, $opt_label) = ('branches', $opt_branch)     if ( $opt_branch );
455
    ($type, $opt_label) = ('trunk', $opt_label)         if ( $opt_trunk);
461
    ($type, $opt_label) = ('trunk', $opt_label)         if ( $opt_trunk);
456
 
462
 
Line 466... Line 472...
466
                      'label'   => $opt_label,
472
                      'label'   => $opt_label,
467
                      'type'    => $type,
473
                      'type'    => $type,
468
                      'new'     => $opt_new,
474
                      'new'     => $opt_new,
469
                      'replace' => $opt_replace,
475
                      'replace' => $opt_replace,
470
                      );
476
                      );
-
 
477
    #
-
 
478
    # Report RmPath as using a pegged version of a new package is a bit silly
-
 
479
    #
471
    Message ("Repository Ref: " . $uref->RmRef);
480
    Message ("Repository Ref: " . $uref->RmPath);
-
 
481
    $uref->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
-
 
482
    $uref->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
472
    $opr_done = 1;
483
    $opr_done = 1;
473
}
484
}
474
 
485
 
475
#-------------------------------------------------------------------------------
486
#-------------------------------------------------------------------------------
476
# Function        : ImportPackage
487
# Function        : ImportPackage
Line 586... Line 597...
586
    #
597
    #
587
    if ( $opt_branch )
598
    if ( $opt_branch )
588
    {
599
    {
589
        $opt_branch = SvnIsaSimpleLabel($opt_branch);
600
        $opt_branch = SvnIsaSimpleLabel($opt_branch);
590
        $url_branch = $svn->BranchName( $opt_branch, 'branches' );
601
        $url_branch = $svn->BranchName( $opt_branch, 'branches' );
591
        $svn->SvnValidateTarget (
602
        my $rv = $svn->SvnValidateTarget (
-
 
603
                        'cmd'    => 'SvnImporter. Create branch',
592
                        'target' => $url_branch,
604
                        'target' => $url_branch,
593
                        'create' => 1,
605
                        'create' => 1,
594
                        );
606
                        );
-
 
607
        if ( $rv == 2 )
-
 
608
        {
-
 
609
            $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
-
 
610
            $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
-
 
611
        }
595
    }
612
    }
596
 
613
 
597
    #
614
    #
598
    #   Create a workspace based on the users package
615
    #   Create a workspace based on the users package
599
    #   Allow the workspace to be reused to speed up multiple
616
    #   Allow the workspace to be reused to speed up multiple
Line 842... Line 859...
842
 
859
 
843
    $opr_done = 1;
860
    $opr_done = 1;
844
}
861
}
845
 
862
 
846
#-------------------------------------------------------------------------------
863
#-------------------------------------------------------------------------------
-
 
864
# Function        : DeleteBranch
-
 
865
#
-
 
866
# Description     : Delete the branch that a workspace is based upon
-
 
867
#
-
 
868
# Inputs          : 
-
 
869
#
-
 
870
# Returns         : 
-
 
871
#
-
 
872
sub DeleteBranch
-
 
873
{
-
 
874
    my $opt_path;
-
 
875
    my $opt_error = 0;
-
 
876
    #
-
 
877
    #   Parse more options
-
 
878
    #
-
 
879
    GetOptions (
-
 
880
                "help:+"        => \$opt_help,
-
 
881
                "manual:3"      => \$opt_help,
-
 
882
                "path:s"        => \$opt_path,
-
 
883
                ) || Error ("Invalid command line" );
-
 
884
 
-
 
885
    #
-
 
886
    #   Subcommand specific help
-
 
887
    #
-
 
888
    SubCommandHelp( $opt_help, "Delete Branch") if ($opt_help);
-
 
889
 
-
 
890
    #
-
 
891
    #   Sanity Tests
-
 
892
    #
-
 
893
    Message ("Delete Workspace Branch" );
-
 
894
    Error ("Too many arguments: @ARGV") if ( $#ARGV >= 0 );
-
 
895
 
-
 
896
    #
-
 
897
    #   Do all the hard work
-
 
898
    #
-
 
899
    $opt_path = '.' unless ( defined $opt_path );
-
 
900
    my $uref = NewSessionByWS($opt_path, 0, 1);
-
 
901
    my $ws_root = $uref->SvnLocateWsRoot(1);
-
 
902
    my $ws_url = $uref->FullWs();
-
 
903
 
-
 
904
    #
-
 
905
    #   Must be a branch
-
 
906
    #
-
 
907
    Error ("Workspace is not based on a branch")
-
 
908
        unless ( $ws_url =~ m ~/branches/~ );
-
 
909
 
-
 
910
    Message ("Deleting: " . $uref->{WSURL} );
-
 
911
    $uref->SvnDelete (
-
 
912
                      'target'    => $ws_url,
-
 
913
                      'comment'   => [$uref->Path().": Delete Branch",'Deleted by user command: jats svn delete-branch'],
-
 
914
                      );
-
 
915
    $opr_done = 1;
-
 
916
}
-
 
917
 
-
 
918
 
-
 
919
#-------------------------------------------------------------------------------
847
# Function        : SubCommandHelp
920
# Function        : SubCommandHelp
848
#
921
#
849
# Description     : Provide help on a subcommand
922
# Description     : Provide help on a subcommand
850
#
923
#
851
# Inputs          : $help_level             - Help Level 1,2,3
924
# Inputs          : $help_level             - Help Level 1,2,3
Line 924... Line 997...
924
    paths                  - Display Subversion tag to URL conversions
997
    paths                  - Display Subversion tag to URL conversions
925
    ls URL                 - List Repo contents for URL
998
    ls URL                 - List Repo contents for URL
926
    tag [URL]              - Convert URL or Path to a Release Manager Tag
999
    tag [URL]              - Convert URL or Path to a Release Manager Tag
927
    url [TAG]              - Convert TAG or Path to a Subversion URL
1000
    url [TAG]              - Convert TAG or Path to a Subversion URL
928
    delete-package URL     - Delete Package Subtree
1001
    delete-package URL     - Delete Package Subtree
-
 
1002
    delete-branch          - Delete a Development Branch
929
    create URL             - Create a new package at URL
1003
    create URL             - Create a new package at URL
930
    import URL             - Import files to package at URL
1004
    import URL             - Import files to package at URL
931
 
1005
 
932
 Use the command
1006
 Use the command
933
    jats svn command -h
1007
    jats svn command -h
Line 1123... Line 1197...
1123
This command will delete a package from the repository. It will ensure
1197
This command will delete a package from the repository. It will ensure
1124
that the package is a valid package, before it is deleted.
1198
that the package is a valid package, before it is deleted.
1125
 
1199
 
1126
The command is intended to be used by test scripts, rather than users.
1200
The command is intended to be used by test scripts, rather than users.
1127
 
1201
 
-
 
1202
=head1 Delete Branch
-
 
1203
 
-
 
1204
=head2 NAME
-
 
1205
 
-
 
1206
Delete the Workspace Branch
-
 
1207
 
-
 
1208
=head2 SYNOPSIS
-
 
1209
 
-
 
1210
jats svn delete-branch [options]
-
 
1211
 
-
 
1212
 Options:
-
 
1213
    -help[=n]              - Help message, [n=1,2,3]
-
 
1214
    -man                   - Full documentation [-help=3]
-
 
1215
    -verbose[=n]           - Verbose command operation
-
 
1216
    -path=path             - Target workspace
-
 
1217
 
-
 
1218
=head2 ARGUMENTS
-
 
1219
 
-
 
1220
The command takes no arguments.
-
 
1221
 
-
 
1222
=head2 OPTIONS
-
 
1223
 
-
 
1224
=over
-
 
1225
 
-
 
1226
=item B<-path=path>
-
 
1227
 
-
 
1228
This options specifies the path of the target workspace. If not provided the
-
 
1229
command will use the current directory.
-
 
1230
 
-
 
1231
=back
-
 
1232
 
-
 
1233
=head2 DESCRIPTION
-
 
1234
 
-
 
1235
This command will delete the branch associated with the workspace in the
-
 
1236
specified path. It is intended to simplify the deletion of Private or
-
 
1237
Development branches.
-
 
1238
 
-
 
1239
If the workspace is not linked to a 'branch' then the command will fail.
-
 
1240
 
1128
=head1 Create a Package Version
1241
=head1 Create a Package Version
1129
 
1242
 
1130
=head2 NAME
1243
=head2 NAME
1131
 
1244
 
1132
Create a Package Version
1245
Create a Package Version
Line 1362... Line 1475...
1362
directory will be deleted, unless re-use is also used.
1475
directory will be deleted, unless re-use is also used.
1363
 
1476
 
1364
=item -author=name
1477
=item -author=name
1365
 
1478
 
1366
This option will force the author of changes as recorded in the repository.
1479
This option will force the author of changes as recorded in the repository.
1367
The repoistory must be configured to allow such changes.
1480
The repository must be configured to allow such changes.
1368
 
1481
 
1369
This option may not work for non-admin users.
1482
This option may not work for non-admin users.
1370
 
1483
 
1371
=item -date=dateString
1484
=item -date=dateString
1372
 
1485
 
1373
This option will force the date of the changes as recorded in the repository.
1486
This option will force the date of the changes as recorded in the repository.
1374
The repoistory must be configured to allow such changes.
1487
The repository must be configured to allow such changes.
1375
The dateString is in a restricted ISO 8601 format: ie 2009-02-12T00:44:04.921324Z
1488
The dateString is in a restricted ISO 8601 format: ie 2009-02-12T00:44:04.921324Z
1376
 
1489
 
1377
This option may not work for non-admin users.
1490
This option may not work for non-admin users.
1378
 
1491
 
1379
=item -log=text
1492
=item -log=text