Merge lp:~kenneth-loafman/duplicity/smart-archive-v2 into lp:~duplicity-team/duplicity/trunk

Proposed by Kenneth Loafman on 2009-06-23
Status: Merged
Approved by: Kenneth Loafman on 2009-06-25
Approved revision: 543
Merged at revision: not available
Proposed branch: lp:~kenneth-loafman/duplicity/smart-archive-v2
Merge into: lp:~duplicity-team/duplicity/trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~kenneth-loafman/duplicity/smart-archive-v2
Reviewer Review Type Date Requested Status
Kenneth Loafman Approve on 2009-06-25
Review via email: mp+7818@code.launchpad.net
To post a comment you must log in.
Kenneth Loafman (kenneth-loafman) wrote :

Changes to allow mixing --archive-dir and --name with reasonable results. Conform to XDG spec.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.project'
--- .project 2009-06-23 09:22:42 +0000
+++ .project 2009-06-23 19:37:55 +0000
@@ -1,6 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>2<projectDescription>
3 <name>duplicity-src</name>3 <name>smart-archive-v2</name>
4 <comment></comment>4 <comment></comment>
5 <projects>5 <projects>
6 </projects>6 </projects>
77
=== modified file '.pydevproject'
--- .pydevproject 2009-04-21 19:50:05 +0000
+++ .pydevproject 2009-06-23 19:37:55 +0000
@@ -5,6 +5,6 @@
5<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>5<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
6<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>6<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
7<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">7<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
8<path>/duplicity-src</path>8<path>/smart-archive-v2</path>
9</pydev_pathproperty>9</pydev_pathproperty>
10</pydev_project>10</pydev_project>
1111
=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py 2009-06-23 09:09:48 +0000
+++ duplicity/commandline.py 2009-06-23 18:57:00 +0000
@@ -127,16 +127,16 @@
127def expand_fn(filename):127def expand_fn(filename):
128 return os.path.expanduser(os.path.expandvars(filename))128 return os.path.expanduser(os.path.expandvars(filename))
129129
130def expand_archive_dir(archdir, args):130
131def expand_archive_dir(archdir, backname):
131 """132 """
132 Expand ~ (user home) and %DUPLICITY_BACKUP_NAME% in archdir and133 Return expanded version of archdir joined with backname.
133 return the result.
134 """134 """
135 assert globals.backup_name is not None, \135 assert globals.backup_name is not None, \
136 "expand_archive_dir() called prior to globals.backup_name being set"136 "expand_archive_dir() called prior to globals.backup_name being set"
137137
138 return expand_fn(archdir).replace('%DUPLICITY_BACKUP_NAME%',138 return expand_fn(os.path.join(archdir, backname))
139 globals.backup_name)139
140140
141def generate_default_backup_name(backend_url):141def generate_default_backup_name(backend_url):
142 """142 """
@@ -158,6 +158,7 @@
158 burlhash.update(backend_url)158 burlhash.update(backend_url)
159 return burlhash.hexdigest()159 return burlhash.hexdigest()
160160
161
161def parse_cmdline_options(arglist):162def parse_cmdline_options(arglist):
162 """Parse argument list"""163 """Parse argument list"""
163 global select_opts, select_files, full_backup164 global select_opts, select_files, full_backup
@@ -411,10 +412,11 @@
411 globals.backup_name = generate_default_backup_name(backend_url)412 globals.backup_name = generate_default_backup_name(backend_url)
412413
413 # set and expand archive dir414 # set and expand archive dir
414 set_archive_dir(expand_archive_dir(globals.archive_dir, args))415 set_archive_dir(expand_archive_dir(globals.archive_dir,
416 globals.backup_name))
415417
418 log.Info(_("Using archive dir: %s") % (globals.archive_dir,))
416 log.Info(_("Using backup name: %s") % (globals.backup_name,))419 log.Info(_("Using backup name: %s") % (globals.backup_name,))
417 log.Info(_("Using archive dir: %s") % (globals.archive_dir,))
418420
419 return args421 return args
420422
421423
=== modified file 'duplicity/globals.py'
--- duplicity/globals.py 2009-06-22 20:44:33 +0000
+++ duplicity/globals.py 2009-06-23 19:37:55 +0000
@@ -21,7 +21,7 @@
2121
22"""Store global configuration information"""22"""Store global configuration information"""
2323
24import socket, sys24import socket, sys, os
2525
26# The current version of duplicity26# The current version of duplicity
27version = "$version"27version = "$version"
@@ -40,7 +40,12 @@
40# contains the signatures and manifests of the relevent backup40# contains the signatures and manifests of the relevent backup
41# collection), and for checkpoint state between volumes.41# collection), and for checkpoint state between volumes.
42# NOTE: this gets expanded in duplicity.commandline42# NOTE: this gets expanded in duplicity.commandline
43archive_dir = "~/.duplicity/%DUPLICITY_BACKUP_NAME%"43os.environ["XDG_CACHE_HOME"] = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache"))
44archive_dir = os.path.expandvars("$XDG_CACHE_HOME/duplicity")
45
46# config dir for future use
47os.environ["XDG_CONFIG_HOME"] = os.getenv("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
48config_dir = os.path.expandvars("$XDG_CONFIG_HOME/duplicity")
4449
45# Restores will try to bring back the state as of the following time.50# Restores will try to bring back the state as of the following time.
46# If it is None, default to current time.51# If it is None, default to current time.

Subscribers

People subscribed via source and target branches

to all changes: