File: pcvs

package info (click to toggle)
pronto 2.4.0-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,112 kB
  • ctags: 487
  • sloc: perl: 22,159; makefile: 127; sh: 34; sql: 7
file content (97 lines) | stat: -rwxr-xr-x 2,055 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/perl
# $Id: pcvs,v 1.2 2001/01/16 23:29:59 muhri Exp $
#Stolen from Mandrake and Raster !!!! Thanks guys. Shame on us perl hackers.. 
#We are so lazy.. hehe

if(($ARGV[0] =~ /com/) || ($ARGV[0] =~ /ci/)) {
	print "We're doing a commit, time to edit the logfile.\n";
	$ARGV[0] .= " -F CommitLog";
	$username=$ENV{USER};
	if (defined $ENV{CVSROOT} && $ENV{CVSROOT} =~ /\:(.+)\:(.+)\@(.*)/){
		$username=$2;
	}
	open COMMITLOG, ">CommitLog";
	print COMMITLOG "Date: ";
	print COMMITLOG `date`;
	print COMMITLOG "\n";
	print COMMITLOG "($username)\n";
  print COMMITLOG "\n";
	print COMMITLOG "\n\n";
	close COMMITLOG;
	if($ENV{EDITOR}) {
		system("$ENV{EDITOR} CommitLog");
	} else {
		system("vi CommitLog");
	}

	open COMMITLOG, "CommitLog";
	@lines = <COMMITLOG>;
	close COMMITLOG;
	if($#lines < 3) {
		unlink "CommitLog";
		print "Obviously this was supposed to be an aborted commit.\n";
		exit(0);
	}
	@ARGV2 = @ARGV;
	$ARGV2[0] = "update";

	print "Force updating changelog\n";
	unlink "ChangeLog";
	system("cvs -z3 update ChangeLog");

	print "Updating the files you are committing.\n";
	system("cvs -z3 @ARGV2 2>&1 |tee errors");

	open ERRORS, "errors";
	while(<ERRORS>) {
		if(/conflicts during merge/) {
			print "There's a conflict.  Resolve and try again.\n";
			unlink "errors" if(-f "errors");
			exit(0);
		}
	}
	close ERRORS;
	
	unlink "errors" if(-f "errors");



	print "Updating the changelog with your entry\n";
	open CHANGELOG, "<ChangeLog";
	@lines = <CHANGELOG>;
	close CHANGELOG;
	`cat CommitLog > ChangeLog`;
	open CHANGELOG, ">>ChangeLog";
	print CHANGELOG "\n-------------------------------------------------------------------------------\n\n";
	foreach (@lines) {
		print CHANGELOG $_;
	}
	close CHANGELOG;

	if($#ARGV >= 1) {
		$found = 0;
		foreach(@ARGV) {
			if(/ChangeLog$/) {
				$found = 1;
			}
		}

		push @ARGV, "ChangeLog" if(!$found);

		$found = 0;
		foreach(@ARGV) {
			if(/timestamp\.h$/) {
				$found = 1;
			}
		}


	}
}

system("cvs -z3 @ARGV");
unlink "CommitLog" if(-f "CommitLog");



`rm -f *~`;