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.

69 lines
1.9 KiB

  1. @rem = '
  2. @perl.exe -w %~f0 %*
  3. @goto :EOF
  4. '; undef @rem;
  5. # Given a changelist, produce 'windiff -l' commands which anyone can use to view
  6. # your changes.
  7. # Assumes that you have a share for your enlistment, which uses the same name
  8. # as the enlistment's root directory (i.e. the _NTROOT envvar).
  9. #
  10. # Or, you can set the exact share name in the CREATECR_SRCPATH envvar.
  11. # e.g. set CREATECR_SRCPATH=\\agodfrey\mynt
  12. $syntax = "Syntax: createcr [<changelist>]\n";
  13. $defaultSourcePath = "\\\\" . $ENV{"computername"} . $ENV{"_ntroot"};
  14. $sourcePath = $ENV{"createcr_srcpath"};
  15. if (!$sourcePath) {
  16. $sourcePath = $defaultSourcePath;
  17. (-d $sourcePath) || die "\"$sourcePath\" not found.\n" .
  18. "Share the root of your enlistment as \"$defaultSourcePath\".\n";
  19. } else {
  20. (-d $sourcePath) || die "\"$sourcePath\" not found.\n" .
  21. "Check the CREATECR_SRCPATH environment variable.\n";
  22. }
  23. ($#ARGV < 1) || die $syntax;
  24. if ($#ARGV >= 0) {
  25. $changelist = $ARGV[0];
  26. } else {
  27. $changelist = "default";
  28. }
  29. if ($changelist ne "default") {
  30. open (DESC, "sd describe -s $changelist|") || die "sd describe failed\n";
  31. while (<DESC>) {
  32. if (/^Affected files/) { last; }
  33. print;
  34. }
  35. close (DESC);
  36. }
  37. open (OPENED, "sd opened -c $changelist|") || die "sd opened failed\n";
  38. while (<OPENED>) {
  39. if (m[^//.*/windows/([^ ]+)#[0-9]+ - (\S+)]i) {
  40. $path = $1; $changeType = $2;
  41. $path =~ tr/\//\\/;
  42. if ($changeType eq "edit") {
  43. print "windiff -l $sourcePath\\windows\\$path\n";
  44. } elsif ($changeType eq "add") {
  45. print "windiff nul $sourcePath\\windows\\$path\n";
  46. } elsif ($changeType eq "delete") {
  47. print "rem Deleted file: $sourcePath\\windows\\$path\n";
  48. } else {
  49. print "Unrecognized change type \"$changeType\"\n";
  50. }
  51. }
  52. }
  53. close (OPENED);