Commits

Ali Gholami Rudi  committed a3d4dc7

Previewing changes that are not done yet

  • Participants
  • Parent commits 979dde1

Comments (0)

Files changed (2)

File rope/base/change.py

         return 'Change <%s>' % self.resource.path
 
     def get_description(self):
+        new = self.new_contents
+        old = self.old_contents
+        if old is None:
+            if self.resource.exists():
+                old = self.resource.read()
+            else:
+                old = ''
         result = difflib.unified_diff(
-            self.old_contents.splitlines(True),
-            self.new_contents.splitlines(True),
+            old.splitlines(True), new.splitlines(True),
             'a/' + self.resource.path, 'b/' + self.resource.path)
         return ''.join(list(result))
 

File ropetest/historytest.py

     @testutils.assert_raises(exceptions.HistoryError)
     def test_undoing_a_not_yet_performed_change(self):
         change = ChangeContents(self.file1, '1')
+        str(change)
         change.undo()