diff options
author | Lars Wirzenius <liw@gytha> | 2008-04-20 17:41:27 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@gytha> | 2008-04-20 17:41:27 +0300 |
commit | e05007300f96f8f477df7f19c79c89e380672e82 (patch) | |
tree | dd99b414c88e1c4dc3dd7f3b71e1cebda68cccbb /obnam | |
parent | 3e6ee40aa181d1ff00c7f5d3d9817cefb42d6fa1 (diff) | |
download | obnam-e05007300f96f8f477df7f19c79c89e380672e82.tar.gz |
Set and get previous generation for a backup run
Diffstat (limited to 'obnam')
-rw-r--r-- | obnam/app.py | 11 | ||||
-rw-r--r-- | obnam/appTests.py | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/obnam/app.py b/obnam/app.py index 46527bf1..926ab69c 100644 --- a/obnam/app.py +++ b/obnam/app.py @@ -41,6 +41,7 @@ class Application: self._exclusion_strings = [] self._exclusion_regexps = [] self._filelist = None + self._prev_gen = None self._store = obnam.Store(self._context) # When we traverse the file system tree while making a backup, @@ -180,6 +181,14 @@ class Application: self._filelist = filelist + def get_previous_generation(self): + """Get the previous generation for a backup run.""" + return self._prev_gen + + def set_previous_generation(self, gen): + """Set the previous generation for a backup run.""" + self._prev_gen = gen + def find_file_by_name(self, filename): """Find a backed up file given its filename. @@ -276,7 +285,7 @@ class Application: directory. """ - + filenames = self._make_absolute(dirname, filenames) filegroups = self.make_filegroups(filenames) filegrouprefs = [fg.get_id() for fg in filegroups] diff --git a/obnam/appTests.py b/obnam/appTests.py index 0df59534..4019dd92 100644 --- a/obnam/appTests.py +++ b/obnam/appTests.py @@ -68,6 +68,13 @@ class ApplicationTests(unittest.TestCase): self.app.prune(dirname, dirnames, filenames) self.failUnlessEqual(dirnames, ["subdir"]) + def testSetsPreviousGenerationToNoneInitially(self): + self.failUnlessEqual(self.app.get_previous_generation(), None) + + def testSetsPreviousGenerationCorrectly(self): + self.app.set_previous_generation("pink") + self.failUnlessEqual(self.app.get_previous_generation(), "pink") + class ApplicationLoadHostBlockTests(unittest.TestCase): |