From 1a0674bf377797513c271af58a0ae30a718d2e9c Mon Sep 17 00:00:00 2001
From: david-sarah <david-sarah@jacaranda.org>
Date: Wed, 16 Jun 2010 20:39:01 -0700
Subject: [PATCH] CLI: allow Unicode patterns in exclude option to 'tahoe
 backup'.

---
 src/allmydata/scripts/cli.py          | 4 ++--
 src/allmydata/scripts/tahoe_backup.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

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)
-- 
2.45.2