Andi Albrecht avatar Andi Albrecht committed b5d1057

Small change to huy's previous patch to only mask @ signs if needed.

This is to avoid that @ is append to URLs containing a peg revision.

Comments (0)

Files changed (3)

         enc = 'utf-8'
     return output.decode(enc)
 
-def run_svn(args=None, bulk_args=None, fail_if_stderr=False):
+def run_svn(args=None, bulk_args=None, fail_if_stderr=False,
+            mask_atsign=False):
     """
     Run an SVN command, returns the (bytes) output.
     """
-    if args:
-        path_arg = args[-1]
-        if "@" in path_arg:
-            args[-1] = "%s@" % args[-1]
+    if mask_atsign:
+        # The @ sign in Subversion revers to a pegged revision number.
+        # SVN treats files with @ in the filename a bit special.
+        # See: http://stackoverflow.com/questions/1985203
+        for idx in enumerate(args):
+            if "@" in args[idx] and args[idx][0] not in ("-", '"'):
+                args[idx] = "%s@" % args[idx]
     return run_command("svn",
         args=args, bulk_args=bulk_args, fail_if_stderr=fail_if_stderr)
 

hgsvn/run/hgimportsvn.py

 
                 # the [2:] strips off the initial './'
                 local_ignores = [os.path.join(path, s.strip())[2:]
-                    for s in run_svn(['propget', 'svn:ignore', path]).splitlines()
+                    for s in run_svn(['propget', 'svn:ignore', path],
+                                     mask_atsign=True).splitlines()
                     if bool(s.strip())
                 ]
                 svn_ignores += local_ignores

hgsvn/run/hgpushsvn.py

     clean_targets = []
     for target in targets:
         try:
-            run_svn(['info', '--xml', target])
+            run_svn(['info', '--xml', target], mask_atsign=True)
         except ExternalCommandFailed, err:
             ui.status(str(err), level=ui.DEBUG)
             continue
     execflags = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
     svn_map = {}
     for fname in files:
-        if run_svn(['propget', 'svn:executable', fname]).strip():
+        if run_svn(['propget', 'svn:executable', fname],
+                   mask_atsign=True).strip():
             svn_map[fname] = True
         else:
             svn_map[fname] = False
         m = os.stat(fname).st_mode & 0777
         is_exec = bool(m & execflags)
         if is_exec and not svn_map[fname]:
-            run_svn(['propset', 'svn:executable', 'ON', fname])
+            run_svn(['propset', 'svn:executable', 'ON', fname],
+                    mask_atsign=True)
         elif not is_exec and svn_map[fname]:
-            run_svn(['propdel', 'svn:executable', fname])
+            run_svn(['propdel', 'svn:executable', fname], mask_atsign=True)
 
 def do_svn_copy(src, dest):
     """
                 if pos == -1:
                     break
 
-                run_svn(['add'], [dest[:pos]])
+                run_svn(['add'], [dest[:pos]], mask_atsign=True)
 
             # Do the copy itself
-            run_svn(['copy', src, dest])
+            run_svn(['copy', src, dest], mask_atsign=True)
         except ExternalCommandFailed:
             # Revert rename
             os.rename(src, dest)
     # Add new files and dirs
     if added:
         bulk_args = get_ordered_dirs(added) + added
-        run_svn(["add"], bulk_args)
+        run_svn(["add"], bulk_args, mask_addsign=True)
     removed = cleanup_svn_unversioned(removed)
     modified = cleanup_svn_unversioned(modified)
     # Remove old files and empty dirs
         # instead of "svn rm foo/bar foo" it should be "svn rm foo".
         # See issue15.
         svn_removed = strip_nested_removes(removed + empty_dirs)
-        run_svn(["rm"], svn_removed)
+        run_svn(["rm"], svn_removed, mask_atsign=True)
     if added or removed or modified:
         svn_sep_line = "--This line, and those below, will be ignored--\n"
         adjust_executable_property(added+modified)  # issue24
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.