Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.9 KiB

  1. @rem = '
  2. @perl.exe -w %~f0 %*
  3. @goto :EOF
  4. '; undef @rem;
  5. # Tool for copying a changelist to another enlistment.
  6. #
  7. # To use it, run it in the source enlistment. It will produce output
  8. # that you can pipe to a batch file.
  9. #
  10. # For the final step, go to the target enlistment and run the batch file.
  11. #
  12. # WARNING: This does NOT handle merge conflicts. No error messages will warn
  13. # you either.
  14. # For best results, make sure the source and target enlistments are sunc up,
  15. # and that none of the files in the changelist you want to copy, are being
  16. # edited on the target enlistment.
  17. #
  18. # NOTE: As with createcr.bat, you need a network share which shares out the
  19. # source enlistment. Either use the default name (\\%computername%%_ntroot%),
  20. # or specify the share name in the CREATECR_SRCPATH envvar.
  21. $syntax = "Syntax: copycl [<changelist>]\n";
  22. $sourcePath = $ENV{"createcr_srcpath"};
  23. if (!$sourcePath) {
  24. $sourcePath = "\\\\" . $ENV{"computername"} . $ENV{"_ntroot"};
  25. }
  26. (-d $sourcePath) || die "$sourcePath not found.\n";
  27. ($#ARGV < 1) || die $syntax;
  28. if ($#ARGV >= 0) {
  29. $changelist = $ARGV[0];
  30. } else {
  31. $changelist = "default";
  32. }
  33. open (OPENED, "sd opened -c $changelist|") || die "sd opened failed\n";
  34. while (<OPENED>) {
  35. if (m[^//.*/windows/([^ ]+)#[0-9]+ - (\S+)]i) {
  36. $path = $1; $changeType = $2;
  37. $path =~ tr/\//\\/;
  38. if ($changeType eq "edit") {
  39. print "sd edit %sdxroot%\\windows\\$path\n";
  40. print "copy $sourcePath\\windows\\$path %sdxroot%\\windows\\$path\n\n";
  41. } elsif ($changeType eq "add") {
  42. print "copy $sourcePath\\windows\\$path %sdxroot%\\windows\\$path\n";
  43. print "sd add %sdxroot%\\windows\\$path\n\n";
  44. } elsif ($changeType eq "delete") {
  45. print "sd delete %sdxroot%\\windows\\$path\n\n";
  46. } else {
  47. print "Unrecognized change type \"$changeType\"\n";
  48. }
  49. }
  50. }
  51. close (OPENED);