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
1=== modified file '.project'
2--- .project 2009-06-23 09:22:42 +0000
3+++ .project 2009-06-23 19:37:55 +0000
4@@ -1,6 +1,6 @@
5 <?xml version="1.0" encoding="UTF-8"?>
6 <projectDescription>
7- <name>duplicity-src</name>
8+ <name>smart-archive-v2</name>
9 <comment></comment>
10 <projects>
11 </projects>
12
13=== modified file '.pydevproject'
14--- .pydevproject 2009-04-21 19:50:05 +0000
15+++ .pydevproject 2009-06-23 19:37:55 +0000
16@@ -5,6 +5,6 @@
17 <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
18 <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
19 <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
20-<path>/duplicity-src</path>
21+<path>/smart-archive-v2</path>
22 </pydev_pathproperty>
23 </pydev_project>
24
25=== modified file 'duplicity/commandline.py'
26--- duplicity/commandline.py 2009-06-23 09:09:48 +0000
27+++ duplicity/commandline.py 2009-06-23 18:57:00 +0000
28@@ -127,16 +127,16 @@
29 def expand_fn(filename):
30 return os.path.expanduser(os.path.expandvars(filename))
31
32-def expand_archive_dir(archdir, args):
33+
34+def expand_archive_dir(archdir, backname):
35 """
36- Expand ~ (user home) and %DUPLICITY_BACKUP_NAME% in archdir and
37- return the result.
38+ Return expanded version of archdir joined with backname.
39 """
40 assert globals.backup_name is not None, \
41 "expand_archive_dir() called prior to globals.backup_name being set"
42
43- return expand_fn(archdir).replace('%DUPLICITY_BACKUP_NAME%',
44- globals.backup_name)
45+ return expand_fn(os.path.join(archdir, backname))
46+
47
48 def generate_default_backup_name(backend_url):
49 """
50@@ -158,6 +158,7 @@
51 burlhash.update(backend_url)
52 return burlhash.hexdigest()
53
54+
55 def parse_cmdline_options(arglist):
56 """Parse argument list"""
57 global select_opts, select_files, full_backup
58@@ -411,10 +412,11 @@
59 globals.backup_name = generate_default_backup_name(backend_url)
60
61 # set and expand archive dir
62- set_archive_dir(expand_archive_dir(globals.archive_dir, args))
63+ set_archive_dir(expand_archive_dir(globals.archive_dir,
64+ globals.backup_name))
65
66+ log.Info(_("Using archive dir: %s") % (globals.archive_dir,))
67 log.Info(_("Using backup name: %s") % (globals.backup_name,))
68- log.Info(_("Using archive dir: %s") % (globals.archive_dir,))
69
70 return args
71
72
73=== modified file 'duplicity/globals.py'
74--- duplicity/globals.py 2009-06-22 20:44:33 +0000
75+++ duplicity/globals.py 2009-06-23 19:37:55 +0000
76@@ -21,7 +21,7 @@
77
78 """Store global configuration information"""
79
80-import socket, sys
81+import socket, sys, os
82
83 # The current version of duplicity
84 version = "$version"
85@@ -40,7 +40,12 @@
86 # contains the signatures and manifests of the relevent backup
87 # collection), and for checkpoint state between volumes.
88 # NOTE: this gets expanded in duplicity.commandline
89-archive_dir = "~/.duplicity/%DUPLICITY_BACKUP_NAME%"
90+os.environ["XDG_CACHE_HOME"] = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache"))
91+archive_dir = os.path.expandvars("$XDG_CACHE_HOME/duplicity")
92+
93+# config dir for future use
94+os.environ["XDG_CONFIG_HOME"] = os.getenv("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
95+config_dir = os.path.expandvars("$XDG_CONFIG_HOME/duplicity")
96
97 # Restores will try to bring back the state as of the following time.
98 # If it is None, default to current time.

Subscribers

People subscribed via source and target branches

to all changes: