Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can source-safe append a copyright message to all files?

5 views
Skip to first unread message

Chris Griffin

unread,
Oct 31, 2000, 1:52:46 PM10/31/00
to

I have a large obnoxious copyright message my employer requires that I put
inside
of all source files. Is there any way I can get SourceSafe to do this for
me?

I'd like to put it at the end of each file. I couldn't find any Keyword
which
might work out for me.

Thanks,
Chris

Ted

unread,
Oct 31, 2000, 4:33:29 PM10/31/00
to
In article <8tn49j$8ii$1...@tribune.oar.net>,

"Chris Griffin" <cgri...@nowhere.com> wrote:
>
> I have a large obnoxious copyright message my employer requires that
I put
> inside
> of all source files. Is there any way I can get SourceSafe to do
this for
> me?

VSS has nothing that will do this automatically for you, but you could
do this from a command prompt with a few simple steps. (If you have
binary files in your database, or other files where you do not want to
add the copyright statement, then this technique would not work as is.
You'd have to modify this technique or use some other technique to
avoid changing such files.)

1) If your database is very large, you may want to sign on to the VSS
file server for better performance.

2) Set the ssdir, ssuser, and sspwd environment variables to the VSS
directory, user and password as desired.

3) Create and switch to a work directory (not necessarily your regular
VSS working folder).

4) Put the copyright statement in a text file somewhere (e.g.,
c:\temp\copyright.txt). You may want to start the file out with a
newline character, just in case you have any source files that do not
end in a carriage return. (Otherwise, the copyright statement will get
tacked on to the end of the last line in the source file.)

5) Check out the entire VSS project tree:

ss checkout $/ -r

5) Append the copyright statement to all checked out files:

for /r %i in (*) do copy "%i"+c:\temp\copyright.txt "%i"

6) Check in all of the files:

ss checkin $/ -r "-cAdd stupid copyright statement"

As an added safety measure, you may want to make a backup of your
database before doing this in case you don't like the result.
Alternatively, you could label the root project ($/) before doing the
checkin command. This will make it easier to rollback your changes if
need be.

While the rollback command does not have a recursive option, you can at
least use it to specify all files in a given project. Therefore, you'd
have to walk through each project in your database yourself. Here's an
example:

ss rollback $/proj1/* -vlbeforechange -i-y

You can also delete the label later if you wish, whether or not you
plan to keep your changes permanent.

Another thing you might want to do is to redirect stdout and stderr to
a file, so you can get a trace of what you have done. Then you can go
back and make sure everything ran as you had expected. That is, tack
something like this at the end of each command:

>>c:\temp\logfile.txt 2>&1


Sent via Deja.com http://www.deja.com/
Before you buy.

Weston Morris

unread,
Nov 7, 2000, 3:00:00 AM11/7/00
to
Hi Chris,

Checkout this article. It explains the notion of 'comment templates', which
might help you out.

http://support.microsoft.com/support/kb/articles/q154/0/81.asp

"Chris Griffin" <cgri...@nowhere.com> wrote in message
news:8tn49j$8ii$1...@tribune.oar.net...

fvi...@my-deja.com

unread,
Nov 9, 2000, 3:00:00 AM11/9/00
to
From the article, it looks like the comment template will only be added
to the Comment property of the Version object created by the check-in.
Can you also have SourceSafe automatically add it to the source code?

In article <#a8pcKQS...@cppssbbsa02.microsoft.com>,


"Weston Morris" <weston.mor...@unisys.com> wrote:
> Hi Chris,
>
> Checkout this article. It explains the notion of 'comment templates',
which
> might help you out.
>
> http://support.microsoft.com/support/kb/articles/q154/0/81.asp

Ted

unread,
Nov 9, 2000, 3:00:00 AM11/9/00
to
In article <8uerp0$8gv$1...@nnrp1.deja.com>,

fvi...@my-deja.com wrote:
> From the article, it looks like the comment template will only be
added
> to the Comment property of the Version object created by the check-in.
> Can you also have SourceSafe automatically add it to the source code?

Yes, using either the History or Log keywords in VSS's keyword
expansion. Look up "keywords" in VSS help for more information.

However, I don't believe this will help the original poster much. For
one thing, you need to physically add the History or Log keywords to
each file yourself, so if the original poster was going to do that, he
might as well add the copyright statement at that time also.
Furthermore, I wouldn't think he'd want the copyright statement to be
added for every single checkin, which will happen if it is added to the
comment template.

0 new messages