[cvsnt] postcommit running cvs but not picking up the latest changes?

Samuel R. Neff srnlists at speakeasy.net
Thu Feb 26 21:01:08 GMT 2004


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


I'm trying to get the postcommit thing running again.  I tried a few months
ago and gave up.

I started by creating a JS script to change directory after commit and then
either checkout or update depending on if the directories already exist.
The JS file follows this e-mail.  It's based on John's Perl script here:

http://www.cvsnt.org/wiki/CvsChapter180

Except it also does a checkout instead of just an update.  It also takes
only the param cvs provides and has the other necessary info set as
variables at the top of the script.

When I run the script manually it works fine.  When I run it based on
post-commit, it doesn't pick up updates.  I found out that if I do two
commits then the post-commit will pick up the earlier updates, so it's just
not picking up the newly committed files.

postcommit runs when everything else is done, so I don't see what's going
wrong.

I'm running everything on a Win XP Pro system.  The script requires Windows
Scripting Host 5.6.  CVSNT is 2.0.24.

Here's the previous thread that has the same problem, but less info, and was
never fully resolved.

http://www.cvsnt.org/pipermail/cvsnt/2003-November/009156.html

Thanks,

Sam



////////////////////////////////////////////////////////////////////////////
////////////////////
//
//  CopyOnCheckin.js
//
//     Upon checkin it checks out all new files to a shadow directory
//
//  Setup
//
//     It uses three file variables which need to be set appropriately.
//
//        cvsProg - absolute path to the cvs.exe program
//        cvsRoot - absolute path to the repository root
//        shadowRoot - absolute path to the root of the shadow directory,
must already exist
//        logFile - absolute path to the log file
//
//     CopyOnCheckin takes one parameter, the path that was checked in in
the form 
//     /repo/module/dir/dir so setting it in postcommit requires only
//
//        ALL C:\Path\To\CopyOnCheckin.js
//     
////////////////////////////////////////////////////////////////////////////
////////////////////

var cvsProg = "c:\\progra~1\\cvsnt\\cvs.exe";
var cvsRoot = "c:\\progra~1\\cvsnt\\repos\\";
var shadowRoot = "c:\\progra~1\\cvsnt\\shadow\\";
var logFile = "c:\\progra~1\\cvsnt\\shadow\\log.txt";

var forAppending = 8;

var wshShell;
var fso;
var logStream;
var checkedInPath;
var checkedInSplit;
var repoName;
var moduleName;
var checkoutRoot;
var i;
var maxI;
var ts;
var dat = new Date();
var month = dat.getMonth().toString();
var day = dat.getDate().toString();

ts = dat.getYear() + "-" + month + "-" + day + " " + dat.toTimeString();

fso = new ActiveXObject("Scripting.FileSystemObject");
logStream = fso.OpenTextFile(logFile, forAppending, true);

if (WScript.Arguments.length == 0) {
   logStream.WriteLine(ts + " - No arguments passed, nothing copied.");
   logStream.Close();
   WScript.Quit(1);
}

checkedInPath = WScript.Arguments(0);
checkedInSplit = checkedInPath.split("/");
repoName = checkedInSplit[1];
moduleName = checkedInSplit[2];

wshShell = new ActiveXObject("WScript.Shell");

if (!fso.FolderExists(shadowRoot + repoName)) {
   fso.CreateFolder(shadowRoot + repoName);
}

if (!fso.FolderExists(shadowRoot + repoName + "\\" + moduleName)) {
   wshShell.CurrentDirectory = shadowRoot + repoName;
   wshShell.Exec(cvsProg + " -d :local:" + cvsRoot + repoName + " checkout "
+ moduleName);
   logStream.WriteLine(ts + " - Checked out /" + repoName + "/" + moduleName
+ " to " + shadowRoot);
} else {
   checkoutRoot = shadowRoot + repoName + "\\" + moduleName;
   maxI = checkedInSplit.length;
   while (i < maxI && fso.FolderExists(checkoutRoot + "\\" +
checkedInSplit[i])) {
      checkoutRoot = checkoutRoot + "\\" + checkedInSplit[i];
      i++;
   }
   wshShell.CurrentDirectory = checkoutRoot;
   wshShell.Exec(cvsProg + " update -dP");
   logStream.WriteLine(ts + " - updated " + checkoutRoot);
}

logStream.Close();





More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook