Commits

Nathan Durnan committed 02f8690

Add test script for recreating test conditions.
Closes Issue #37 at BitBucket.

  • Participants
  • Parent commits 6593e2c
  • Branches BBI#37 - Save Only Committed Timestamps

Comments (0)

Files changed (2)

 ".hgignore": {"timestamp": 1336516662.38},
 ".hgtags": {"timestamp": 1327960909.75},
 "README.md": {"timestamp": 1339691478.75},
+"Tests/TimestampMod_BBI37_Test.bat": {"timestamp": 1341343207.95},
 "TimeStampMod.png": {"timestamp": 1305052883.0},
 "TimestampMod.py": {"timestamp": 1341339063.7},
 "TimeStampMod.xmind": {"timestamp": 1306451621.66},

Tests/TimestampMod_BBI37_Test.bat

+::------------------------------------------------------------------------------
+:: Tests for BitBucket Issue #37 - Save Timestamp for Committed Files ONLY.
+:: When committing specific files, the extension is saving the timestamps of ALL
+:: files tracked in the repository even if they are not included in the commit.
+:: It should only be saving timestamps for files included in the commit.
+::------------------------------------------------------------------------------
+:: This test-script creates a temporary test repository and adds two files to it.
+:: * The first test will modify both files and commit only one of them.
+::    - Only the timestamp for the committed file should be changed.
+:: * The second test will modify both files and commit without specifying a file.
+::    - The timestamps for both of the files should be changed.
+::------------------------------------------------------------------------------
+@echo off
+echo Initializing Test Repository...
+if exist testrepo rmdir /S /Q testrepo
+mkdir testrepo
+cd testrepo
+hg init
+echo Create first file (abc.txt)
+echo "abc" > abc.txt
+hg add abc.txt
+hg commit -m "abc"
+echo Create second file (bcd.txt)
+echo "abc" > bcd.txt
+hg add bcd.txt
+hg commit -m "add bcd"
+echo.
+echo ============================================
+echo Test #1: Modify both files, commit only one.
+echo.
+echo ----------
+echo Timestamps before changes
+type .hgtimestamp
+echo "abc" >> abc.txt
+echo "efg" >> bcd.txt
+echo.
+echo.
+echo hg commit -m "commit bcd only" bcd.txt
+hg commit -m "commit bcd only" bcd.txt
+echo.
+echo ----------
+echo Timestamps after committing only bcd.txt
+type .hgtimestamp
+echo.
+echo ------------------------------------------------------
+echo CHECK: ONLY the bcd.txt timestamp should have changed.
+echo ======================================================
+pause
+echo.
+echo.
+echo ==============================================
+echo Test #2: Modify both files, commit everything.
+echo.
+echo ----------
+echo Timestamps before commit
+type .hgtimestamp
+echo "123" >> abc.txt
+echo "456" >> bcd.txt
+echo.
+echo.
+echo hg commit -m "commit all (no match)"
+hg commit -m "commit all (no match)"
+echo.
+echo ----------
+echo Timestamps after committing with no Match
+type .hgtimestamp
+echo.
+echo -------------------------------------------
+echo CHECK: BOTH timestamps should have changed.
+echo ===========================================
+pause