Merge "Support filtering by group on forall and list subcmd"
diff --git a/manifest_xml.py b/manifest_xml.py
index 130e17c..7e71960 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -202,6 +202,9 @@
     if d.revisionExpr:
       have_default = True
       e.setAttribute('revision', d.revisionExpr)
+    if d.destBranchExpr:
+      have_default = True
+      e.setAttribute('dest-branch', d.destBranchExpr)
     if d.sync_j > 1:
       have_default = True
       e.setAttribute('sync-j', '%d' % d.sync_j)
@@ -267,6 +270,9 @@
         if p.upstream and p.upstream != p.revisionExpr:
           e.setAttribute('upstream', p.upstream)
 
+      if p.dest_branch and p.dest_branch != d.destBranchExpr:
+        e.setAttribute('dest-branch', p.dest_branch)
+
       for c in p.copyfiles:
         ce = doc.createElement('copyfile')
         ce.setAttribute('src', c.src)
diff --git a/project.py b/project.py
index 868425c..9cb7542 100644
--- a/project.py
+++ b/project.py
@@ -2347,10 +2347,11 @@
     if copy_all:
       to_copy = os.listdir(gitdir)
 
+    dotgit = os.path.realpath(dotgit)
     for name in set(to_copy).union(to_symlink):
       try:
         src = os.path.realpath(os.path.join(gitdir, name))
-        dst = os.path.realpath(os.path.join(dotgit, name))
+        dst = os.path.join(dotgit, name)
 
         if os.path.lexists(dst):
           continue
diff --git a/subcmds/sync.py b/subcmds/sync.py
index a8074a4..43d450b 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -314,7 +314,9 @@
         pm.update()
       except _FetchError:
         err_event.set()
-      except:
+      except Exception as e:
+        print('error: Cannot fetch %s (%s: %s)' \
+            % (project.name, type(e).__name__, str(e)), file=sys.stderr)
         err_event.set()
         raise
     finally: