Thread (1 message) 1 message, 1 author, 2019-07-17

Re: git p4 sync: "str expected, not %s"

From: Massimo B. <hidden>
Date: 2019-07-17 10:59:50

Still failing:

On Fri, 2019-07-12 at 22:39 -0400, Andrey wrote:
quoted hunk
Could you, please, try the patch below?
diff --git a/git-p4.py b/git-p4.py
index 5b79920f46..f5be048348 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -4137,13 +4137,13 @@ def main():
     if cmd.needsGit:
         if cmd.gitdir == None:
             cmd.gitdir = os.path.abspath(".git")
             if not isValidGitDir(cmd.gitdir):
                 # "rev-parse --git-dir" without arguments will try $PWD/.git
-                cmd.gitdir = read_pipe("git rev-parse --git-dir").strip()
+                cmd.gitdir = read_pipe("git rev-parse --git-
dir").strip().decode()
                 if os.path.exists(cmd.gitdir):
-                    cdup = read_pipe("git rev-parse --show-cdup").strip()
+                    cdup = read_pipe("git rev-parse --show-
cdup").strip().decode()
                     if len(cdup) > 0:
                         chdir(cdup);

         if not isValidGitDir(cmd.gitdir):
             if isValidGitDir(cmd.gitdir + "/.git"):
# git p4 sync
Traceback (most recent call last):
  File "/usr/libexec/git-core/git-p4", line 4163, in <module>
    main()
  File "/usr/libexec/git-core/git-p4", line 4157, in main
    if not cmd.run(args):
  File "/usr/libexec/git-core/git-p4", line 3569, in run
    branches = p4BranchesInGit(self.importIntoRemotes)
  File "/usr/libexec/git-core/git-p4", line 844, in p4BranchesInGit
    if not line.startswith('p4/'):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

quoted hunk
Or, even this one:
diff --git a/git-p4.py b/git-p4.py
index 5b79920f46..2bf6720911 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -196,6 +196,10 @@ def read_pipe_full(c):
     expand = isinstance(c,basestring)
     p = subprocess.Popen(c, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=expand)
     (out, err) = p.communicate()
+    if out is not None:
+        out = out.decode()
+    if err is not None:
+        err = err.decode()
     return (p.returncode, out, err)

 def read_pipe(c, ignore_error=False):
# git p4 sync
Traceback (most recent call last):
  File "/usr/libexec/git-core/git-p4", line 4167, in <module>
    main()
  File "/usr/libexec/git-core/git-p4", line 4146, in main
    cmd.gitdir = read_pipe("git rev-parse --git-dir").strip().decode()
AttributeError: 'str' object has no attribute 'decode'

Best regards,
Massimo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help