Subversion Repositories DevTools

Rev

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

Rev 2054 Rev 2429
Line 263... Line 263...
263
    #
263
    #
264
    my $uref;
264
    my $uref;
265
    my $url;
265
    my $url;
266
    if ( $opt_tag )
266
    if ( $opt_tag )
267
    {
267
    {
-
 
268
        my $path = $opt_tag;
-
 
269
        my $label;
-
 
270
 
-
 
271
        $path =~ s~^SVN::~~;
-
 
272
        if ( $path =~ m~(.+)::(.+)~ )
-
 
273
        {
-
 
274
            $path = $1;
-
 
275
            $label = $2;
-
 
276
        }
268
        $url = SvnPath2Url($opt_tag);
277
        $url = SvnPath2Url($path);
-
 
278
        if ( $label && $label =~ m~^\d+$~ )
-
 
279
        {
-
 
280
            $url .= '@' . $label;
-
 
281
        }
-
 
282
        elsif ( $label )
-
 
283
        {
-
 
284
            $url =~ m~(.+)(/(tags|branches|trunk)(/|$|@))~;
-
 
285
            $url = $1 . '/tags/'. $label;
-
 
286
        }
269
    }
287
    }
270
    else
288
    else
271
    {
289
    {
272
        $uref = NewSessionByWS($opt_path, 0, 1);
290
        $uref = NewSessionByWS($opt_path, 0, 1);
273
        my $ws_root = $uref->SvnLocateWsRoot(1);
291
        my $ws_root = $uref->SvnLocateWsRoot(1);
Line 518... Line 536...
518
    my $opt_date;
536
    my $opt_date;
519
    my $opt_log = '';
537
    my $opt_log = '';
520
    my $opt_branch;
538
    my $opt_branch;
521
    my $opt_datafile;
539
    my $opt_datafile;
522
    my $opt_printfiles;
540
    my $opt_printfiles;
-
 
541
    my $opt_commit = 1;
523
 
542
 
524
    #
543
    #
525
    #   Other globals
544
    #   Other globals
526
    #
545
    #
527
    my $url_label;
546
    my $url_label;
Line 545... Line 564...
545
                    'printfiles=i'  => \$opt_printfiles,
564
                    'printfiles=i'  => \$opt_printfiles,
546
                    'author=s'      => \$opt_author,
565
                    'author=s'      => \$opt_author,
547
                    'date=s'        => \$opt_date,
566
                    'date=s'        => \$opt_date,
548
                    'log=s'         => \$opt_log,
567
                    'log=s'         => \$opt_log,
549
                    'datafile=s'    => \$opt_datafile,
568
                    'datafile=s'    => \$opt_datafile,
-
 
569
                    'commit!'       => \$opt_commit,
550
 
570
 
551
                    #
571
                    #
552
                    #   Update documentation at the end of the file
572
                    #   Update documentation at the end of the file
553
                    #
573
                    #
554
                    ) || Error ("Invalid command line" );
574
                    ) || Error ("Invalid command line" );
Line 575... Line 595...
575
    #   Configure the error reporting process now that we have the user options
595
    #   Configure the error reporting process now that we have the user options
576
    #
596
    #
577
    Error ("No package URL specified") unless ( $opt_package );
597
    Error ("No package URL specified") unless ( $opt_package );
578
    Error ("No base directory specified") unless ( $opt_dir );
598
    Error ("No base directory specified") unless ( $opt_dir );
579
    Error ("Invalid base directory: $opt_dir") unless ( -d $opt_dir );
599
    Error ("Invalid base directory: $opt_dir") unless ( -d $opt_dir );
-
 
600
    Error ("Cannot label if not committing") if ( $opt_label && ! $opt_commit );
580
 
601
 
581
    #
602
    #
582
    #   Create an SVN session
603
    #   Create an SVN session
583
    #
604
    #
584
    my $svn = NewSessionByUrl ( $opt_package );
605
    my $svn = NewSessionByUrl ( $opt_package );
Line 832... Line 853...
832
 
853
 
833
    #
854
    #
834
    #   Commit the workspace
855
    #   Commit the workspace
835
    #   This will go back onto the trunk
856
    #   This will go back onto the trunk
836
    #
857
    #
837
    $svn = NewSessionByWS( $opt_workdir );
-
 
838
    my $pkgPath = $svn->Path();
-
 
839
 
-
 
840
    my $ciComment = "$pkgPath: Checkin by Svn Import";
-
 
841
    $ciComment .= "\n" . $opt_log if ( $opt_log );
-
 
842
    $ciComment =~ s~\r\n~\n~g;
-
 
843
    $ciComment =~ s~\r~\n~g;
-
 
844
    $ciComment = encode('UTF-8', $ciComment, Encode::FB_DEFAULT);
-
 
845
 
-
 
846
    $svn->SvnCi ('comment' => $ciComment, 'allowSame' => 1 );
-
 
847
    Message ("Repository Ref: " . $svn->RmRef) unless( $opt_label );
-
 
848
    $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
-
 
849
    $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
-
 
850
 
-
 
851
    #
-
 
852
    #   Label the result
-
 
853
    #   The workspace will have been updated, so we can use it as the base for
-
 
854
    #   the labeling process
-
 
855
    #
-
 
856
    if ( $opt_label )
858
    if ( $opt_commit )
857
    {
859
    {
858
        $svn->SvnCopyWs (
860
        $svn = NewSessionByWS( $opt_workdir );
859
                       target => $url_label,
861
        my $pkgPath = $svn->Path();
-
 
862
 
860
                       'noswitch' => 1,
863
        my $ciComment = "$pkgPath: Checkin by Svn Import";
861
                       'replace' => $opt_replace,
864
        $ciComment .= "\n" . $opt_log if ( $opt_log );
862
                       'comment' => "$pkgPath: Tagged by Jats Svn Import",
865
        $ciComment =~ s~\r\n~\n~g;
863
                       );
866
        $ciComment =~ s~\r~\n~g;
-
 
867
        $ciComment = encode('UTF-8', $ciComment, Encode::FB_DEFAULT);
-
 
868
 
864
        Message ("Repository Ref: " . $svn->RmRef);
869
        $svn->SvnCi ('comment' => $ciComment, 'allowSame' => 1 );
865
        Message ("Vcs Tag       : " . $svn->SvnTag);
870
        Message ("Repository Ref: " . $svn->RmRef) unless( $opt_label );
866
        $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
871
        $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
867
        $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
872
        $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
-
 
873
 
-
 
874
        #
-
 
875
        #   Label the result
-
 
876
        #   The workspace will have been updated, so we can use it as the base for
-
 
877
        #   the labeling process
-
 
878
        #
-
 
879
        if ( $opt_label )
-
 
880
        {
-
 
881
            $svn->SvnCopyWs (
-
 
882
                           target => $url_label,
-
 
883
                           'noswitch' => 1,
-
 
884
                           'replace' => $opt_replace,
-
 
885
                           'comment' => "$pkgPath: Tagged by Jats Svn Import",
-
 
886
                           );
-
 
887
            Message ("Repository Ref: " . $svn->RmRef);
-
 
888
            Message ("Vcs Tag       : " . $svn->SvnTag);
-
 
889
            $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
-
 
890
            $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
-
 
891
        }
-
 
892
    }
-
 
893
    else
-
 
894
    {
-
 
895
        Message ("Workspace not commited","Workspace: $opt_workdir");
868
    }
896
    }
869
 
897
 
870
    #
898
    #
871
    #   Clean up
899
    #   Clean up
872
    #
900
    #
873
    if ( $opt_delete && ! $opt_reuse )
901
    if ( $opt_delete && ! $opt_reuse  && $opt_commit )
874
    {
902
    {
875
        Message ("Delete Workspace");
903
        Message ("Delete Workspace");
876
        rmtree( $opt_workdir );
904
        rmtree( $opt_workdir );
877
    }
905
    }
878
 
906
 
Line 923... Line 951...
923
    SubCommandHelp( $opt_help, "Delete Branch") if ($opt_help);
951
    SubCommandHelp( $opt_help, "Delete Branch") if ($opt_help);
924
 
952
 
925
    #
953
    #
926
    #   Sanity Tests
954
    #   Sanity Tests
927
    #
955
    #
928
    Message ("Delete Workspace Branch" );
956
    Message ("Delete Workspace Branchs" );
929
    Error ("Too many arguments: @ARGV") if ( $#ARGV >= 0 );
-
 
930
 
957
 
931
    #
958
    #
932
    #   Do all the hard work
959
    #   Do all the hard work
933
    #
960
    #
934
    $opt_path = '.' unless ( defined $opt_path );
961
    $opt_path = '.' unless ( defined $opt_path );
935
    my $uref = NewSessionByWS($opt_path, 0, 1);
962
    my $uref = NewSessionByWS($opt_path, 0, 1);
936
    my $ws_root = $uref->SvnLocateWsRoot(1);
963
    my $ws_root = $uref->SvnLocateWsRoot(1);
937
    my $ws_url = $uref->FullWs();
964
    my $ws_url = $uref->FullWs();
938
 
965
 
939
    #
966
    #
940
    #   Must be a branch
967
    #   What we do depends what aruments the user provided
941
    #
968
    #
-
 
969
    unless ( @ARGV )
-
 
970
    {
-
 
971
        #
-
 
972
        #   If no branch was specified - then display the workspace branch
-
 
973
        #
942
    Error ("Workspace is not based on a branch")
974
        Error ('The workspace is not based on a branch')
943
        unless ( $ws_url =~ m ~/branches/~ );
975
            unless ( $ws_url =~ m ~/branches/(.*)~ );
-
 
976
        Message('The workspace is based on the branch: '. $1);
-
 
977
    }
-
 
978
    else
944
 
979
    {
-
 
980
        #
-
 
981
        #   Delete all specified branches
-
 
982
        #
-
 
983
        foreach my $branch ( @ARGV )
-
 
984
        {
945
    Message ("Deleting: " . $uref->{WSURL} );
985
            Message ("Deleting: " . $branch );
-
 
986
            my $target = join( '/', $uref->FullPath(), 'branches', $branch);
946
    $uref->SvnDelete (
987
            if ( $uref->SvnDelete (
947
                      'target'    => $ws_url,
988
                              'target'    => $target,
948
                      'comment'   => [$uref->Path().": Delete Branch",'Deleted by user command: jats svn delete-branch'],
989
                              'comment'   => [$uref->Path().": Delete Branch",'Deleted by user command: jats svn delete-branch'],
-
 
990
                              'noerror'   => 1,
949
                      );
991
                              )
-
 
992
               )
-
 
993
            {
-
 
994
                Warning ("Branch deletion failed: $branch");
-
 
995
            }
-
 
996
        }
-
 
997
    }
950
    $opr_done = 1;
998
    $opr_done = 1;
951
}
999
}
952
 
1000
 
953
#-------------------------------------------------------------------------------
1001
#-------------------------------------------------------------------------------
954
# Function        : CreateBranch
1002
# Function        : CreateBranch
Line 1257... Line 1305...
1257
=item B<-man>
1305
=item B<-man>
1258
 
1306
 
1259
This is the same as '-help=3'.
1307
This is the same as '-help=3'.
1260
The complete help is produced in a man page format.
1308
The complete help is produced in a man page format.
1261
 
1309
 
1262
=item B<--verbose[=n]>
1310
=item B<-verbose[=n]>
1263
 
1311
 
1264
This option will increase the level of verbosity of the commands.
1312
This option will increase the level of verbosity of the commands.
1265
 
1313
 
1266
If an argument is provided, then it will be used to set the level, otherwise the
1314
If an argument is provided, then it will be used to set the level, otherwise the
1267
existing level will be incremented. This option may be specified multiple times.
1315
existing level will be incremented. This option may be specified multiple times.
Line 1375... Line 1423...
1375
 
1423
 
1376
This command will convert a TAG or a PATH to a full URL that can be used
1424
This command will convert a TAG or a PATH to a full URL that can be used
1377
directly by Subversion. If no PATH or TAG is provided, then the command uses a
1425
directly by Subversion. If no PATH or TAG is provided, then the command uses a
1378
path of the current directory.
1426
path of the current directory.
1379
 
1427
 
1380
The command will convert either a TAG or a URL. It will not do both.
1428
The command will convert either a TAG or a PATH. It will not do both.
1381
 
1429
 
1382
The command will use the configured Subversion URL prefixes to expand the TAG.
1430
The command will use the configured Subversion URL prefixes to expand the TAG.
1383
 
1431
 
1384
If a PATH is to be converted, then the PATH must address a Subversion workspace.
1432
If a PATH is to be converted, then the PATH must address a Subversion workspace.
1385
The conversion will return a URL to the root of the Workspace and Peg it to
1433
The conversion will return a URL to the root of the Workspace and Peg it to
Line 1388... Line 1436...
1388
 
1436
 
1389
If a TAG is to be converted, then the resultant value should be used with
1437
If a TAG is to be converted, then the resultant value should be used with
1390
caution. The result is only as good as the provided URL and may not address
1438
caution. The result is only as good as the provided URL and may not address
1391
the root of a package.
1439
the root of a package.
1392
 
1440
 
-
 
1441
=head3 Examples
-
 
1442
 
-
 
1443
To display the URL of the current workspace
-
 
1444
 
-
 
1445
    jats svn url
-
 
1446
 
-
 
1447
To display the URL of a known workspace
-
 
1448
 
-
 
1449
    jats svn url -path=myWorkSpace
-
 
1450
 
-
 
1451
To convert a TAG from Release Manager or other JATS commands
-
 
1452
 
-
 
1453
    jats svn url AUPERASVN01/COTS
-
 
1454
    jats svn url SVN::AUPERASVN01/COTS/bouncycastle/trunk::bouncycastle_1.3.1.cots@502
-
 
1455
 
1393
=head1 Create a Package Version
1456
=head1 Create a Package Version
1394
 
1457
 
1395
=head2 NAME
1458
=head2 NAME
1396
 
1459
 
1397
Create a Package Version
1460
Create a Package Version
Line 1407... Line 1470...
1407
 
1470
 
1408
 Command Options
1471
 Command Options
1409
    -help[=n]               - Provide command specific help
1472
    -help[=n]               - Provide command specific help
1410
    -new                    - Package must not exist
1473
    -new                    - Package must not exist
1411
    -replace                - Replace any existing versions
1474
    -replace                - Replace any existing versions
1412
    -import=nnn             - Import directory tree
1475
    -import=path            - Import directory tree
1413
    -label=nnn              - Label imported package
1476
    -label=nnn              - Label imported package
1414
    -trunk                  - Import to trunk (default)
1477
    -trunk                  - Import to trunk (default)
1415
    -tags=nnn               - Import to tags
1478
    -tags=nnn               - Import to tags
1416
    -branch=nnn             - Import to branches
1479
    -branch=nnn             - Import to branches
1417
 
1480
 
Line 1451... Line 1514...
1451
 
1514
 
1452
This option allows the program to replace any existing versions of the
1515
This option allows the program to replace any existing versions of the
1453
imported source. It will allow the deletion of any existing trunk, tags or
1516
imported source. It will allow the deletion of any existing trunk, tags or
1454
branches.
1517
branches.
1455
 
1518
 
1456
=item -import=nnn
1519
=item -import=path
1457
 
1520
 
1458
This option specifies the path of a subdirectory tree to import into the newly
1521
This option specifies the path of a subdirectory tree to import into the newly
1459
created package. In not provided, then only a package skeleton will be created.
1522
created package. In not provided, then only a package skeleton will be created.
1460
 
1523
 
-
 
1524
All files and directories below, but not including, the named path will be
-
 
1525
imported into the package.
-
 
1526
 
1461
=item -label=nnn
1527
=item -label=nnn
1462
 
1528
 
1463
This option specifies a label to place the imported source.
1529
This option specifies a label to place the imported source.
1464
 
1530
 
1465
=item -trunk
1531
=item -trunk
Line 1506... Line 1572...
1506
 
1572
 
1507
The command does not attempt to merge file versions within the repository. It
1573
The command does not attempt to merge file versions within the repository. It
1508
may result in multiple instances of a file within the repository. Use only for
1574
may result in multiple instances of a file within the repository. Use only for
1509
simple imports. Use the 'import' command for more sophisticated import requirements.
1575
simple imports. Use the 'import' command for more sophisticated import requirements.
1510
 
1576
 
-
 
1577
=head3 Examples
-
 
1578
 
-
 
1579
To create a package skeleton in the Perth MREF_Package repository for a package
-
 
1580
called 'VIXmyPackage':
-
 
1581
 
-
 
1582
    jats svn create-package AUPERASVN01/MREF_Package/VIXmyPackage
-
 
1583
 
-
 
1584
To create a package skeleton in the Perth MREF_Package repository, import code
-
 
1585
into the trunk of the package and label (tag) it:
-
 
1586
    
-
 
1587
    jats svn create-package \
-
 
1588
           AUPERASVN01/MREF_Package/VIXmyPackage \
-
 
1589
           -import=VIXmyNewPackage \
-
 
1590
           -label=VIXmyPackage.WIP
-
 
1591
 
1511
=head1 Delete a Package
1592
=head1 Delete a Package
1512
 
1593
 
1513
=head2 NAME
1594
=head2 NAME
1514
 
1595
 
1515
Delete a Package
1596
Delete a Package
Line 1657... Line 1738...
1657
 
1738
 
1658
=item   2. Switch to the named branch.
1739
=item   2. Switch to the named branch.
1659
 
1740
 
1660
The named branch must exists otherwise the command will fail.
1741
The named branch must exists otherwise the command will fail.
1661
 
1742
 
1662
There are two spcial variants of the branch name:
1743
There are two special variants of the branch name:
1663
 
1744
 
1664
=over 4
1745
=over 4
1665
 
1746
 
1666
=item trunk
1747
=item trunk
1667
 
1748
 
Line 1703... Line 1784...
1703
 
1784
 
1704
Delete the Workspace Branch
1785
Delete the Workspace Branch
1705
 
1786
 
1706
=head2 SYNOPSIS
1787
=head2 SYNOPSIS
1707
 
1788
 
1708
jats svn delete-branch [options]
1789
jats svn delete-branch [options] [branch-list]
1709
 
1790
 
1710
 Options:
1791
 Options:
1711
    -help[=n]              - Help message, [n=1,2,3]
1792
    -help[=n]              - Help message, [n=1,2,3]
1712
    -man                   - Full documentation [-help=3]
1793
    -man                   - Full documentation [-help=3]
1713
    -verbose[=n]           - Verbose command operation
1794
    -verbose[=n]           - Verbose command operation
1714
    -path=path             - Target workspace
1795
    -path=path             - Target workspace
1715
 
1796
 
1716
=head2 ARGUMENTS
1797
=head2 ARGUMENTS
1717
 
1798
 
-
 
1799
The command may take zero or more arguments. If provided the arguments will be
1718
The command takes no arguments.
1800
branch names to be deleted.
1719
 
1801
 
1720
=head2 OPTIONS
1802
=head2 OPTIONS
1721
 
1803
 
1722
=over
1804
=over
1723
 
1805
 
Line 1728... Line 1810...
1728
 
1810
 
1729
=back
1811
=back
1730
 
1812
 
1731
=head2 DESCRIPTION
1813
=head2 DESCRIPTION
1732
 
1814
 
1733
This command will delete the branch associated with the workspace in the
1815
This command can display the branch associated with the workspace or it can
1734
specified path. It is intended to simplify the deletion of Private or
1816
delete one or more branches. It is intended to simplify the deletion of Private
1735
Development branches.
1817
or Development branches.
-
 
1818
 
-
 
1819
=over 4
-
 
1820
 
-
 
1821
=item 1 Arguments are provided
-
 
1822
 
-
 
1823
The command will delete all the named branches. If a named branch does not exist
-
 
1824
then the command will issue a warning message.
-
 
1825
 
-
 
1826
=item 2 No arguments provided
-
 
1827
 
-
 
1828
The command will display the branch associated with the workspace
1736
 
1829
 
1737
If the workspace is not linked to a 'branch' then the command will fail.
1830
If the workspace is not linked to a 'branch' then the command will fail.
1738
 
1831
 
-
 
1832
=back
-
 
1833
 
1739
=head1 Import directory to a Package
1834
=head1 Import directory to a Package
1740
 
1835
 
1741
=head2 NAME
1836
=head2 NAME
1742
 
1837
 
1743
Import directory to a Package
1838
Import directory to a Package
Line 1764... Line 1859...
1764
    -[no]delete             - Deletes workspace after use. Default:yes
1859
    -[no]delete             - Deletes workspace after use. Default:yes
1765
    -author=name            - Force author of changes
1860
    -author=name            - Force author of changes
1766
    -date=dateString        - Force date of changes
1861
    -date=dateString        - Force date of changes
1767
    -log=text               - Append text to the commit message
1862
    -log=text               - Append text to the commit message
1768
    -datafile=path          - Export tag data for automation
1863
    -datafile=path          - Export tag data for automation
-
 
1864
    -[no]commit             - Prevent chnages being commited. Default:Yes
-
 
1865
    -printfiles=n           - Control commit verbosity
1769
 
1866
 
1770
=head2 ARGUMENTS
1867
=head2 ARGUMENTS
1771
 
1868
 
1772
The command takes one argument: The URL of the desired package.
1869
The command takes one argument: The URL of the desired package.
1773
This may be be:
1870
This may be be:
Line 1874... Line 1971...
1874
=item -datafile=path
1971
=item -datafile=path
1875
 
1972
 
1876
This option will cause the utility to create a data file to record the import
1973
This option will cause the utility to create a data file to record the import
1877
tag. It is used for automation of the import process.
1974
tag. It is used for automation of the import process.
1878
 
1975
 
-
 
1976
=item -[no]commit
-
 
1977
 
-
 
1978
This option will prevent the final workspace from being committed to the
-
 
1979
Repository. This allows inspection of the results.
-
 
1980
 
-
 
1981
The default operation is to commit and label the results of the import.
-
 
1982
 
-
 
1983
=item -printfiles=n
-
 
1984
 
-
 
1985
This option controls commit verbosity. The default operation is to display
-
 
1986
the files added and removed during the commit.
-
 
1987
 
-
 
1988
Suitable numbers are: None, 0 (No Display) and 1 (Full Display).
-
 
1989
 
1879
=back
1990
=back
1880
 
1991
 
1881
=head2 DESCRIPTION
1992
=head2 DESCRIPTION
1882
 
1993
 
1883
Import a new version of a package to the trunk of the package. The utility
1994
Import a new version of a package to the trunk of the package. The utility