Commits

Anonymous committed 54b701e

Clearing redo list after each do
Using file size for detecting changes, too

Comments (0)

Files changed (6)

docs/dev/issues.txt

 
 Issues:
 
-* Where should we put scope statements that are outside other
-  sub-scopes?
+Statements
+----------
 
-  * Keep them on their own place; Might cause problems
-  * Put them at the end of scope; What to do for imports
-  * Put them at the start of scope; Might cause problems
-  * Hang them to the upper scope; Problems like imports
-  * Hang them to the lower scope; Problems like __main__ checks
+Where should we put scope statements that are outside other
+sub-scopes?
 
-* How to specify the new order?
+* Keep them on their own place; Might cause problems
+* Put them at the end of scope; What to do for imports
+* Put them at the start of scope; Might cause problems
+* Hang them to the upper scope; Problems like imports
+* Hang them to the lower scope; Problems like __main__ checks
+
+One way of solving it might be to insert each block after all of the
+blocks that appear before it.  This solves the problem for imports and
+__main__ checks.
+
+
+Blanks
+------
+
+What to do with blanks?
+
+* Each scope should own the blanks after it
+* Each scope should own the blanks before it
+* Leave the blanks in their own places
+* Use a predefined number of blanks; 1 or 2?
+* Each scopes should own the blanks after it except the last one
+
+
+Specifying The New Order
+------------------------
+
+How to specify the new order?
+
+
+Sort Kinds
+----------
+
+* Alphabetically
+* Classes first
+* Functions first
+* Not-underlined first
+* With-pydocs first
+* Longest first
+* Manual
+
+
+Handling Name Redefinitions
+===========================
+
+Currently python elements overwrite others with the same name.  This
+makes some problems for some refactorings.
 
 
 Enhancing Refactorings

docs/dev/workingon.txt

 Small Stories
 =============
 
-- Adding ``ignore_syntax_errors`` project config
+- Using file size for detecting changes, too
+- Clearing redo list after each do
+- Renaming `Timekeeper` to `ChangeIndicator`
 
 * Updating and adding docs on SOI
 * Adding restructuring scope; local scope, module, all files?

rope/base/history.py

             self.undo_list.append(changes)
             if len(self.undo_list) > self.max_undos:
                 del self.undo_list[0]
+        del self.redo_list[:]
 
     def _is_change_interesting(self, changes):
         for resource in changes.get_changed_resources():

rope/base/project.py

         if timekeeper is not None:
             self.timekeeper = timekeeper
         else:
-            self.timekeeper = Timekeeper()
+            self.timekeeper = ChangeIndicator()
         if initial_resources is not None:
             for resource in initial_resources:
                 self.add_resource(resource)
     def add_resource(self, resource):
         """Add a resource to the list of interesting resources"""
         if resource.exists():
-            self.resources[resource] = self.timekeeper.getmtime(resource)
+            self.resources[resource] = self.timekeeper.get_indicator(resource)
         else:
             self.resources[resource] = None
 
     def _perform_changes(self, changes):
         for resource in changes.changes:
             self.observer.resource_changed(resource)
-            self.resources[resource] = self.timekeeper.getmtime(resource)
+            self.resources[resource] = self.timekeeper.get_indicator(resource)
         for resource, new_resource in changes.moves.items():
             self.resources[resource] = None
             if new_resource is not None:
                 self.observer.resource_removed(resource)
         for resource in changes.creations:
             self.observer.resource_created(resource)
-            self.resources[resource] = self.timekeeper.getmtime(resource)
+            self.resources[resource] = self.timekeeper.get_indicator(resource)
 
     def validate(self, resource):
         moved = self._search_resource_moves(resource)
     def _is_changed(self, resource):
         if self.resources[resource] is None:
             return False
-        return self.resources[resource] != self.timekeeper.getmtime(resource)
+        return self.resources[resource] != self.timekeeper.get_indicator(resource)
 
     def _calculate_new_resource(self, main, new_main, resource):
         if new_main is None:
         return resource.project.get_resource(new_main.path + diff)
 
 
-class Timekeeper(object):
+class ChangeIndicator(object):
 
-    def getmtime(self, resource):
-        """Return the modification time of a `Resource`."""
-        return os.path.getmtime(resource.real_path)
+    def get_indicator(self, resource):
+        """Return the modification time and size of a `Resource`."""
+        return (os.path.getmtime(resource.real_path),
+                os.path.getsize(resource.real_path))
 
 
 class _Changes(object):

ropetest/historytest.py

         self.assertEquals(set([change1]),
                           set(self.history.get_file_undo_list(old_file)))
 
+    def test_clearing_redo_list_after_do(self):
+        change = ChangeContents(self.file1, '1')
+        self.history.do(change)
+        self.history.undo()
+        self.history.do(change)
+        self.assertEquals(0, len(self.history.redo_list))
+
 
 class SavingHistoryTest(unittest.TestCase):
 

ropetest/projecttest.py

     def test_validation_and_changing_files(self):
         my_file = self.project.root.create_file('my_file.txt')
         sample_observer = _SampleObserver()
-        timekeeper = _MockTimeKeepter()
+        timekeeper = _MockChangeIndicator()
         filtered_observer = FilteredResourceObserver(sample_observer, [my_file],
                                                      timekeeper=timekeeper)
         self.project.add_observer(filtered_observer)
         self._write_file(my_file.real_path)
-        timekeeper.setmtime(my_file, 1)
+        timekeeper.set_indicator(my_file, 1)
         self.project.validate(self.project.root)
         self.assertEquals(1, sample_observer.change_count)
 
     def test_validation_and_changing_files2(self):
         my_file = self.project.root.create_file('my_file.txt')
         sample_observer = _SampleObserver()
-        timekeeper = _MockTimeKeepter()
+        timekeeper = _MockChangeIndicator()
         self.project.add_observer(FilteredResourceObserver(
                                   sample_observer, [my_file],
                                   timekeeper=timekeeper))
-        timekeeper.setmtime(my_file, 1)
+        timekeeper.set_indicator(my_file, 1)
         my_file.write('hey')
         self.assertEquals(1, sample_observer.change_count)
         self.project.validate(self.project.root)
         self.assertEquals((file1, file2), sample_observer.last_moved)
 
 
-class _MockTimeKeepter(object):
+class _MockChangeIndicator(object):
 
     def __init__(self):
         self.times = {}
 
-    def setmtime(self, resource, time):
+    def set_indicator(self, resource, time):
         self.times[resource] = time
 
-    def getmtime(self, resource):
+    def get_indicator(self, resource):
         return self.times.get(resource, 0)
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.