Merge lp:~mterry/duplicity/fix-drop-u1 into lp:duplicity/0.6

Proposed by Michael Terry
Status: Merged
Merged at revision: 973
Proposed branch: lp:~mterry/duplicity/fix-drop-u1
Merge into: lp:duplicity/0.6
Diff against target: 165 lines (+39/-50)
2 files modified
duplicity/backend.py (+39/-49)
po/POTFILES.in (+0/-1)
To merge this branch: bzr merge lp:~mterry/duplicity/fix-drop-u1
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+216387@code.launchpad.net

Description of the change

Looks like when the drop-u1 branch got merged, its conflict got resolved badly. Here is the right version of backend.py to use (and also drops u1backend.py from POTFILES).

To post a comment you must log in.
Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Kinda surprised the merge failed. I resolved the conflict by selecting
'resolve using other', which should have just taken your copy as is.

On Thu, Apr 17, 2014 at 3:00 PM, <email address hidden> wrote:

> The proposal to merge lp:~mterry/duplicity/fix-drop-u1 into lp:duplicity
> has been updated.
>
> Status: Needs review => Merged
>
> For more details, see:
> https://code.launchpad.net/~mterry/duplicity/fix-drop-u1/+merge/216387
> --
> https://code.launchpad.net/~mterry/duplicity/fix-drop-u1/+merge/216387
> Your team duplicity-team is requested to review the proposed merge of
> lp:~mterry/duplicity/fix-drop-u1 into lp:duplicity.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~duplicity-team
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~duplicity-team
> More help : https://help.launchpad.net/ListHelp
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'duplicity/backend.py'
2--- duplicity/backend.py 2014-04-17 17:58:17 +0000
3+++ duplicity/backend.py 2014-04-17 19:03:17 +0000
4@@ -32,13 +32,12 @@
5 import getpass
6 import gettext
7 import urllib
8+import urlparse
9
10 from duplicity import dup_temp
11-from duplicity import dup_threading
12 from duplicity import file_naming
13 from duplicity import globals
14 from duplicity import log
15-from duplicity import urlparse_2_5 as urlparser
16 from duplicity import progress
17
18 from duplicity.util import exception_traceback
19@@ -58,6 +57,27 @@
20 _forced_backend = None
21 _backends = {}
22
23+# These URL schemes have a backend with a notion of an RFC "network location".
24+# The 'file' and 's3+http' schemes should not be in this list.
25+# 'http' and 'https' are not actually used for duplicity backend urls, but are needed
26+# in order to properly support urls returned from some webdav servers. adding them here
27+# is a hack. we should instead not stomp on the url parsing module to begin with.
28+#
29+# This looks similar to urlparse's 'uses_netloc' list, but urlparse doesn't use
30+# that list for parsing, only creating urls. And doesn't include our custom
31+# schemes anyway. So we keep our own here for our own use.
32+uses_netloc = ['ftp',
33+ 'ftps',
34+ 'hsi',
35+ 'rsync',
36+ 's3',
37+ 'scp', 'ssh', 'sftp',
38+ 'webdav', 'webdavs',
39+ 'gdocs',
40+ 'http', 'https',
41+ 'imap', 'imaps',
42+ 'mega']
43+
44
45 def import_backends():
46 """
47@@ -165,46 +185,6 @@
48 raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))
49
50
51-_urlparser_initialized = False
52-_urlparser_initialized_lock = dup_threading.threading_module().Lock()
53-
54-def _ensure_urlparser_initialized():
55- """
56- Ensure that the appropriate clobbering of variables in the
57- urlparser module has been done. In the future, the need for this
58- clobbering to begin with should preferably be eliminated.
59- """
60- def init():
61- global _urlparser_initialized
62-
63- if not _urlparser_initialized:
64- # These URL schemes have a backend with a notion of an RFC "network location".
65- # The 'file' and 's3+http' schemes should not be in this list.
66- # 'http' and 'https' are not actually used for duplicity backend urls, but are needed
67- # in order to properly support urls returned from some webdav servers. adding them here
68- # is a hack. we should instead not stomp on the url parsing module to begin with.
69- #
70- # todo: eliminate the need for backend specific hacking here completely.
71- urlparser.uses_netloc = ['ftp',
72- 'ftps',
73- 'hsi',
74- 'rsync',
75- 's3',
76- 'scp', 'ssh', 'sftp',
77- 'webdav', 'webdavs',
78- 'gdocs',
79- 'http', 'https',
80- 'imap', 'imaps',
81- 'mega']
82-
83- # Do not transform or otherwise parse the URL path component.
84- urlparser.uses_query = []
85- urlparser.uses_fragm = []
86-
87- _urlparser_initialized = True
88-
89- dup_threading.with_lock(_urlparser_initialized_lock, init)
90-
91 class ParsedUrl:
92 """
93 Parse the given URL as a duplicity backend URL.
94@@ -218,7 +198,6 @@
95 """
96 def __init__(self, url_string):
97 self.url_string = url_string
98- _ensure_urlparser_initialized()
99
100 # While useful in some cases, the fact is that the urlparser makes
101 # all the properties in the URL deferred or lazy. This means that
102@@ -226,7 +205,7 @@
103 # problems here, so they will be caught early.
104
105 try:
106- pu = urlparser.urlparse(url_string)
107+ pu = urlparse.urlparse(url_string)
108 except Exception:
109 raise InvalidBackendURL("Syntax error in: %s" % url_string)
110
111@@ -272,26 +251,37 @@
112 self.port = None
113 try:
114 self.port = pu.port
115- except Exception:
116+ except Exception: # not raised in python2.7+, just returns None
117 # old style rsync://host::[/]dest, are still valid, though they contain no port
118 if not ( self.scheme in ['rsync'] and re.search('::[^:]*$', self.url_string)):
119 raise InvalidBackendURL("Syntax error (port) in: %s A%s B%s C%s" % (url_string, (self.scheme in ['rsync']), re.search('::[^:]+$', self.netloc), self.netloc ) )
120
121+ # Our URL system uses two slashes more than urlparse's does when using
122+ # non-netloc URLs. And we want to make sure that if urlparse assuming
123+ # a netloc where we don't want one, that we correct it.
124+ if self.scheme not in uses_netloc:
125+ if self.netloc:
126+ self.path = '//' + self.netloc + self.path
127+ self.netloc = ''
128+ self.hostname = None
129+ elif self.path.startswith('/'):
130+ self.path = '//' + self.path
131+
132 # This happens for implicit local paths.
133- if not pu.scheme:
134+ if not self.scheme:
135 return
136
137 # Our backends do not handle implicit hosts.
138- if pu.scheme in urlparser.uses_netloc and not pu.hostname:
139+ if self.scheme in uses_netloc and not self.hostname:
140 raise InvalidBackendURL("Missing hostname in a backend URL which "
141 "requires an explicit hostname: %s"
142 "" % (url_string))
143
144 # Our backends do not handle implicit relative paths.
145- if pu.scheme not in urlparser.uses_netloc and not pu.path.startswith('//'):
146+ if self.scheme not in uses_netloc and not self.path.startswith('//'):
147 raise InvalidBackendURL("missing // - relative paths not supported "
148 "for scheme %s: %s"
149- "" % (pu.scheme, url_string))
150+ "" % (self.scheme, url_string))
151
152 def geturl(self):
153 return self.url_string
154
155=== modified file 'po/POTFILES.in'
156--- po/POTFILES.in 2014-04-16 20:45:09 +0000
157+++ po/POTFILES.in 2014-04-17 19:03:17 +0000
158@@ -29,7 +29,6 @@
159 duplicity/backends/_boto_single.py
160 duplicity/backends/_boto_multi.py
161 duplicity/backends/__init__.py
162-duplicity/backends/u1backend.py
163 duplicity/backends/dpbxbackend.py
164 duplicity/backends/ftpsbackend.py
165 duplicity/backends/hsibackend.py

Subscribers

People subscribed via source and target branches

to all changes: