Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6887 dpurdie 1
#! perl
2
########################################################################
3
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
4
#
5
# Module name   : jats.sh
6
# Module type   : Makefile system
7
# Compiler(s)   : n\a
8
# Environment(s): jats
9
#
10
# Description   : Process a hijacked file(s)
11
#                 Check it in on a branch
12
#
13
# Usage:
14
#
15
# Version   Who      Date        Description
16
#
17
#......................................................................#
18
 
19
require 5.006_001;
20
use strict;
21
use warnings;
22
#use Data::Dumper;
23
use Getopt::Long;
24
use Pod::Usage;                         # required for help support
25
use Win32::Shortcut;
26
 
27
my $opt_verbose = 0;                    # Verbosity
28
my $opt_help = 0;
29
my $opt_manual;
30
my $VERSION = "1.0.0";
31
 
32
#
33
#   Globals
34
#
35
my $svnDir = 'C:\Program Files\TortoiseSVN\bin';
36
my $svnExe = $svnDir . '\TortoiseProc.exe';
37
 
38
#-------------------------------------------------------------------------------
39
# Function        : Main Entry
40
#
41
# Description     : This small program will process hijacked files in a
42
#                   static view. It will create a branch for the file and then
43
#                   check the file in on the branch
44
#
45
#
46
# Inputs          : None
47
#
48
# Returns         : Even less.
49
#
50
 
51
my $result = GetOptions (
52
                "help+"     => \$opt_help,          # flag, multiple use allowed
53
                "manual"    => \$opt_manual,        # flag
54
                "verbose+"  => \$opt_verbose,       # flag
55
                );
56
 
57
#
58
#   Process help and manual options
59
#
60
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
61
pod2usage(-verbose => 1)  if ($opt_help == 2 );
62
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
63
 
64
createSpecials();
65
 
66
#
67
#   Process files one by one
68
#
69
foreach  ( glob ('//auawsasvn001/d$/Repositories/*') )
70
{
71
    next unless ( -d $_ );
72
    process_file( $_ );
73
}
74
exit;
75
 
76
#-------------------------------------------------------------------------------
77
# Function        : process_file
78
#
79
# Description     : 
80
#
81
# Inputs          : 
82
#
83
# Returns         : 
84
#
85
sub process_file
86
{
87
    my ($fpath) = @_;
88
    my $reponame = $fpath;
89
    $reponame =~ s~.*/~~;
90
    my $svnCmd = '/command:repobrowser /path:https://auawsasvn001.vix.local/svn/';
91
 
92
print "Shortcut: $reponame\n";
93
    my $link = Win32::Shortcut->new();
94
	$link->{'File'} = $reponame . '.lnk';
95
	$link->{'Path'} = $svnExe;
96
	$link->{'Arguments'} = $svnCmd . $reponame;
97
	$link->{'Description'} = $reponame . ' Repository';
98
	$link->{'ShowCmd'} = 1;
99
	$link->{'IconLocation'} = $svnExe;
100
	$link->{'IconNumber'} = '1';
101
	$link->{'WorkingDirectory'} = $svnDir;
102
	my $rv = $link->Save();
103
    unless ( defined $rv )
104
    {
105
        print "Error creating $link->{'File'}\n";
106
    }
107
}
108
 
109
#-------------------------------------------------------------------------------
110
# Function        : createSpecial
111
#
112
# Description     : 
113
#
114
# Inputs          : 
115
#
116
# Returns         : 
117
#
118
sub createSpecials
119
{
120
    my $link = Win32::Shortcut->new();
121
	$link->{'File'} = 'TortoiseSVN Config' . '.lnk';
122
	$link->{'Path'} = 'C:\Users\dpurdie\AppData\Roaming\Subversion\config';
123
	#$link->{'Arguments'} = '';
124
	$link->{'Description'} = 'Edit Tortoise SVN Config';
125
	$link->{'ShowCmd'} = 1;
126
	#$link->{'IconLocation'} = $svnExe;
127
	#$link->{'IconNumber'} = '1';
128
	$link->{'WorkingDirectory'} = 'C:\Users\dpurdie\AppData\Roaming\Subversion';
129
	my $rv = $link->Save();
130
    unless ( defined $rv )
131
    {
132
        print "Error creating $link->{'File'}\n";
133
    }
134
 
135
 
136
    $link = Win32::Shortcut->new();
137
	$link->{'File'} = 'TortoiseSVN Settings' . '.lnk';
138
	$link->{'Path'} = $svnExe;
139
	$link->{'Arguments'} = '/command:settings';
140
	$link->{'Description'} = 'TortoiseSVN Settings';
141
	$link->{'ShowCmd'} = 1;
142
	$link->{'IconLocation'} = $svnExe;
143
	$link->{'IconNumber'} = '1';
144
	$link->{'WorkingDirectory'} = $svnDir;
145
	$rv = $link->Save();
146
    unless ( defined $rv )
147
    {
148
        print "Error creating $link->{'File'}\n";
149
    }
150
 
151
    $link = Win32::Shortcut->new();
152
	$link->{'File'} = 'TortoiseSVN' . '.lnk';
153
	$link->{'Path'} = $svnExe;
154
	$link->{'Arguments'} = '/command:repobrowser';
155
	$link->{'Description'} = 'TortoiseSVN Repo Browser';
156
	$link->{'ShowCmd'} = 1;
157
	$link->{'IconLocation'} = $svnExe;
158
	$link->{'IconNumber'} = '1';
159
	$link->{'WorkingDirectory'} = $svnDir;
160
	$rv = $link->Save();
161
    unless ( defined $rv )
162
    {
163
        print "Error creating $link->{'File'}\n";
164
    }
165
 
166
}
167
 
168
#-------------------------------------------------------------------------------
169
#   Documentation
170
#
171
 
172
=pod
173
 
174
=head1 NAME
175
 
176
xxxxx - Save a hijacked file on a private branch
177
 
178
=head1 SYNOPSIS
179
 
180
  xxxxxx [options] files...
181
 
182
 Options:
183
    -help               - brief help message
184
    -help -help         - Detailed help message
185
    -man                - Full documentation
186
    -verbose            - Verbose operation
187
 
188
=head1 OPTIONS
189
 
190
=over 8
191
 
192
=item B<-help>
193
 
194
Print a brief help message and exits.
195
 
196
=item B<-help -help>
197
 
198
Print a detailed help message with an explanation for each option.
199
 
200
=item B<-man>
201
 
202
Prints the manual page and exits.
203
 
204
=item B<-verbose>
205
 
206
Increases program output. This option may be specified mutiple times
207
 
208
=back
209
 
210
=head1 DESCRIPTION
211
 
212
This small program will process hijacked files in a static view. It will create
213
a branch for the file and then check the file in on the branch
214
 
215
=cut
216