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
=== modified file 'duplicity/backend.py'
--- duplicity/backend.py 2014-04-17 17:58:17 +0000
+++ duplicity/backend.py 2014-04-17 19:03:17 +0000
@@ -32,13 +32,12 @@
32import getpass32import getpass
33import gettext33import gettext
34import urllib34import urllib
35import urlparse
3536
36from duplicity import dup_temp37from duplicity import dup_temp
37from duplicity import dup_threading
38from duplicity import file_naming38from duplicity import file_naming
39from duplicity import globals39from duplicity import globals
40from duplicity import log40from duplicity import log
41from duplicity import urlparse_2_5 as urlparser
42from duplicity import progress41from duplicity import progress
4342
44from duplicity.util import exception_traceback43from duplicity.util import exception_traceback
@@ -58,6 +57,27 @@
58_forced_backend = None57_forced_backend = None
59_backends = {}58_backends = {}
6059
60# These URL schemes have a backend with a notion of an RFC "network location".
61# The 'file' and 's3+http' schemes should not be in this list.
62# 'http' and 'https' are not actually used for duplicity backend urls, but are needed
63# in order to properly support urls returned from some webdav servers. adding them here
64# is a hack. we should instead not stomp on the url parsing module to begin with.
65#
66# This looks similar to urlparse's 'uses_netloc' list, but urlparse doesn't use
67# that list for parsing, only creating urls. And doesn't include our custom
68# schemes anyway. So we keep our own here for our own use.
69uses_netloc = ['ftp',
70 'ftps',
71 'hsi',
72 'rsync',
73 's3',
74 'scp', 'ssh', 'sftp',
75 'webdav', 'webdavs',
76 'gdocs',
77 'http', 'https',
78 'imap', 'imaps',
79 'mega']
80
6181
62def import_backends():82def import_backends():
63 """83 """
@@ -165,46 +185,6 @@
165 raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))185 raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))
166186
167187
168_urlparser_initialized = False
169_urlparser_initialized_lock = dup_threading.threading_module().Lock()
170
171def _ensure_urlparser_initialized():
172 """
173 Ensure that the appropriate clobbering of variables in the
174 urlparser module has been done. In the future, the need for this
175 clobbering to begin with should preferably be eliminated.
176 """
177 def init():
178 global _urlparser_initialized
179
180 if not _urlparser_initialized:
181 # These URL schemes have a backend with a notion of an RFC "network location".
182 # The 'file' and 's3+http' schemes should not be in this list.
183 # 'http' and 'https' are not actually used for duplicity backend urls, but are needed
184 # in order to properly support urls returned from some webdav servers. adding them here
185 # is a hack. we should instead not stomp on the url parsing module to begin with.
186 #
187 # todo: eliminate the need for backend specific hacking here completely.
188 urlparser.uses_netloc = ['ftp',
189 'ftps',
190 'hsi',
191 'rsync',
192 's3',
193 'scp', 'ssh', 'sftp',
194 'webdav', 'webdavs',
195 'gdocs',
196 'http', 'https',
197 'imap', 'imaps',
198 'mega']
199
200 # Do not transform or otherwise parse the URL path component.
201 urlparser.uses_query = []
202 urlparser.uses_fragm = []
203
204 _urlparser_initialized = True
205
206 dup_threading.with_lock(_urlparser_initialized_lock, init)
207
208class ParsedUrl:188class ParsedUrl:
209 """189 """
210 Parse the given URL as a duplicity backend URL.190 Parse the given URL as a duplicity backend URL.
@@ -218,7 +198,6 @@
218 """198 """
219 def __init__(self, url_string):199 def __init__(self, url_string):
220 self.url_string = url_string200 self.url_string = url_string
221 _ensure_urlparser_initialized()
222201
223 # While useful in some cases, the fact is that the urlparser makes202 # While useful in some cases, the fact is that the urlparser makes
224 # all the properties in the URL deferred or lazy. This means that203 # all the properties in the URL deferred or lazy. This means that
@@ -226,7 +205,7 @@
226 # problems here, so they will be caught early.205 # problems here, so they will be caught early.
227206
228 try:207 try:
229 pu = urlparser.urlparse(url_string)208 pu = urlparse.urlparse(url_string)
230 except Exception:209 except Exception:
231 raise InvalidBackendURL("Syntax error in: %s" % url_string)210 raise InvalidBackendURL("Syntax error in: %s" % url_string)
232211
@@ -272,26 +251,37 @@
272 self.port = None251 self.port = None
273 try:252 try:
274 self.port = pu.port253 self.port = pu.port
275 except Exception:254 except Exception: # not raised in python2.7+, just returns None
276 # old style rsync://host::[/]dest, are still valid, though they contain no port255 # old style rsync://host::[/]dest, are still valid, though they contain no port
277 if not ( self.scheme in ['rsync'] and re.search('::[^:]*$', self.url_string)):256 if not ( self.scheme in ['rsync'] and re.search('::[^:]*$', self.url_string)):
278 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 ) )257 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 ) )
279258
259 # Our URL system uses two slashes more than urlparse's does when using
260 # non-netloc URLs. And we want to make sure that if urlparse assuming
261 # a netloc where we don't want one, that we correct it.
262 if self.scheme not in uses_netloc:
263 if self.netloc:
264 self.path = '//' + self.netloc + self.path
265 self.netloc = ''
266 self.hostname = None
267 elif self.path.startswith('/'):
268 self.path = '//' + self.path
269
280 # This happens for implicit local paths.270 # This happens for implicit local paths.
281 if not pu.scheme:271 if not self.scheme:
282 return272 return
283273
284 # Our backends do not handle implicit hosts.274 # Our backends do not handle implicit hosts.
285 if pu.scheme in urlparser.uses_netloc and not pu.hostname:275 if self.scheme in uses_netloc and not self.hostname:
286 raise InvalidBackendURL("Missing hostname in a backend URL which "276 raise InvalidBackendURL("Missing hostname in a backend URL which "
287 "requires an explicit hostname: %s"277 "requires an explicit hostname: %s"
288 "" % (url_string))278 "" % (url_string))
289279
290 # Our backends do not handle implicit relative paths.280 # Our backends do not handle implicit relative paths.
291 if pu.scheme not in urlparser.uses_netloc and not pu.path.startswith('//'):281 if self.scheme not in uses_netloc and not self.path.startswith('//'):
292 raise InvalidBackendURL("missing // - relative paths not supported "282 raise InvalidBackendURL("missing // - relative paths not supported "
293 "for scheme %s: %s"283 "for scheme %s: %s"
294 "" % (pu.scheme, url_string))284 "" % (self.scheme, url_string))
295285
296 def geturl(self):286 def geturl(self):
297 return self.url_string287 return self.url_string
298288
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2014-04-16 20:45:09 +0000
+++ po/POTFILES.in 2014-04-17 19:03:17 +0000
@@ -29,7 +29,6 @@
29duplicity/backends/_boto_single.py29duplicity/backends/_boto_single.py
30duplicity/backends/_boto_multi.py30duplicity/backends/_boto_multi.py
31duplicity/backends/__init__.py31duplicity/backends/__init__.py
32duplicity/backends/u1backend.py
33duplicity/backends/dpbxbackend.py32duplicity/backends/dpbxbackend.py
34duplicity/backends/ftpsbackend.py33duplicity/backends/ftpsbackend.py
35duplicity/backends/hsibackend.py34duplicity/backends/hsibackend.py

Subscribers

People subscribed via source and target branches

to all changes: