From: david-sarah Date: Thu, 17 Jun 2010 03:39:01 +0000 (-0700) Subject: CLI: allow Unicode patterns in exclude option to 'tahoe backup'. X-Git-Tag: trac-4500~6 X-Git-Url: https://git.rkrishnan.org/htmlfontify-example.html?a=commitdiff_plain;h=1a0674bf377797513c271af58a0ae30a718d2e9c;p=tahoe-lafs%2Ftahoe-lafs.git CLI: allow Unicode patterns in exclude option to 'tahoe backup'. --- diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index 9f440b02..afef264b 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -295,14 +295,14 @@ class BackupOptions(VDriveOptions): def opt_exclude(self, pattern): """Ignore files matching a glob pattern. You may give multiple '--exclude' options.""" - g = pattern.strip() + g = argv_to_unicode(pattern).strip() if g: exclude = self['exclude'] exclude.add(g) def opt_exclude_from(self, filepath): """Ignore file matching glob patterns listed in file, one per - line.""" + line. The file is assumed to be in the argv encoding.""" try: exclude_file = file(filepath) except: diff --git a/src/allmydata/scripts/tahoe_backup.py b/src/allmydata/scripts/tahoe_backup.py index e332b9f5..8b853c9e 100644 --- a/src/allmydata/scripts/tahoe_backup.py +++ b/src/allmydata/scripts/tahoe_backup.py @@ -173,8 +173,8 @@ class BackerUpper: children = [] for child in self.options.filter_listdir(children): + assert isinstance(child, unicode), child childpath = os.path.join(localpath, child) - child = unicode(child) # note: symlinks to directories are both islink() and isdir() if os.path.isdir(childpath) and not os.path.islink(childpath): metadata = get_local_metadata(childpath)