OLD | NEW |
1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
2 # Copyright (C) 2009 Apple Inc. All rights reserved. | 2 # Copyright (C) 2009 Apple Inc. All rights reserved. |
3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved. | 3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T08:05:49Z') | 248 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T08:05:49Z') |
249 | 249 |
250 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130' | 250 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130' |
251 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-07T23:32:03Z') | 251 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-07T23:32:03Z') |
252 | 252 |
253 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800' | 253 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800' |
254 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T09:55:21Z') | 254 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T09:55:21Z') |
255 | 255 |
256 def test_unstaged_files(self): | 256 def test_unstaged_files(self): |
257 scm = self.make_scm() | 257 scm = self.make_scm() |
258 status_lines = [ | 258 lines = [ |
259 ' M d/modified.txt', | 259 ' M d/modified.txt', |
260 ' D d/deleted.txt', | 260 ' D d/deleted.txt', |
261 '?? d/untracked.txt', | 261 '?? d/untracked.txt', |
262 'D d/deleted.txt', | 262 'D d/deleted.txt', |
263 'M d/modified-staged.txt', | 263 'M d/modified-staged.txt', |
264 'A d/added-staged.txt', | 264 'A d/added-staged.txt', |
265 ] | 265 ] |
266 # pylint: disable=protected-access | 266 scm._run_git = lambda _: '\x00'.join(lines) + '\x00' # pylint: disable=
protected-access |
267 scm._run_git = lambda args: '\x00'.join(status_lines) + '\x00' | |
268 self.assertEqual( | 267 self.assertEqual( |
269 scm.unstaged_changes(), | 268 scm.unstaged_changes(), |
270 { | 269 { |
271 'd/modified.txt': 'M', | 270 'd/modified.txt': 'M', |
272 'd/deleted.txt': 'D', | 271 'd/deleted.txt': 'D', |
273 'd/untracked.txt': '?', | 272 'd/untracked.txt': '?', |
274 }) | 273 }) |
| 274 |
| 275 def test_unstaged_files_with_no_changes(self): |
| 276 scm = self.make_scm() |
| 277 scm._run_git = lambda _: '\x00' # pylint: disable=protected-access |
| 278 self.assertEqual(scm.unstaged_changes(), {}) |
OLD | NEW |