diff options
author | W. Trevor King <wking@drexel.edu> | 2008-11-16 14:54:52 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-11-16 14:54:52 -0500 |
commit | fd4678b2c6c46488b1c0922e4b737ce908e29abd (patch) | |
tree | 67a6bc62f49cdce444928936241d14fd0460db77 /.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c | |
parent | 4bc4079e6d1495f47398a6b685f45fe40e304a0c (diff) | |
parent | f6253f4c6ba301954a5b9beed4e5b41e74bb8004 (diff) | |
download | bugseverywhere-fd4678b2c6c46488b1c0922e4b737ce908e29abd.tar.gz |
Merged in my git.py changed fixing Hubert Chathi's git set-root bug (0cad).
Diffstat (limited to '.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c')
9 files changed, 206 insertions, 0 deletions
diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/16ba77d3-dfc9-4732-8d08-0e471f400d85/body b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/16ba77d3-dfc9-4732-8d08-0e471f400d85/body new file mode 100644 index 0000000..595381c --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/16ba77d3-dfc9-4732-8d08-0e471f400d85/body @@ -0,0 +1,34 @@ +When I try to do set-root on a git repository, I get: +# be set-root . +Traceback (most recent call last): + File "/usr/local/bin/be", line 55, in <module> + sys.exit(execute(sys.argv[1], sys.argv[2:])) + File "/usr/lib/python2.5/site-packages/libbe/cmdutil.py", line 105, in execute + File "/usr/lib/python2.5/site-packages/becommands/set_root.py", line 57, in execute + File "/usr/lib/python2.5/site-packages/libbe/bugdir.py", line 110, in create_bug_dir + File "/usr/lib/python2.5/site-packages/libbe/bugdir.py", line 70, in set_version + File "/usr/lib/python2.5/site-packages/libbe/git.py", line 51, in set_file_contents + File "/usr/lib/python2.5/site-packages/libbe/git.py", line 38, in add_id + File "/usr/lib/python2.5/site-packages/libbe/git.py", line 33, in invoke_client + File "/usr/lib/python2.5/site-packages/libbe/rcs.py", line 63, in invoke + File "/usr/lib/python2.5/subprocess.py", line 594, in __init__ + errread, errwrite) + File "/usr/lib/python2.5/subprocess.py", line 1147, in _execute_child + raise child_exception +OSError: [Errno 2] No such file or directory: '' + +because the cwd argument for Popen is set to '' (the empty string). + +The following patch fixes the issue: +--- libbe/git.py 2008-06-22 19:52:14.000000000 -0400 ++++ libbe/git.py 2008-06-23 00:53:39.000000000 -0400 +@@ -26,7 +26,7 @@ + return filename + + def invoke_client(*args, **kwargs): +- directory = kwargs['directory'] ++ directory = kwargs['directory'] or None + expect = kwargs.get('expect', (0, 1)) + cl_args = ["git"] + cl_args.extend(args) + diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/16ba77d3-dfc9-4732-8d08-0e471f400d85/values b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/16ba77d3-dfc9-4732-8d08-0e471f400d85/values new file mode 100644 index 0000000..d55baa7 --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/16ba77d3-dfc9-4732-8d08-0e471f400d85/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Mon, 23 Jun 2008 05:02:22 +0000 + + + + + + +From=hubert + + + diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/17a2217e-fc1d-4d7a-a569-4fd2a4a2261e/body b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/17a2217e-fc1d-4d7a-a569-4fd2a4a2261e/body new file mode 100644 index 0000000..49fe1fb --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/17a2217e-fc1d-4d7a-a569-4fd2a4a2261e/body @@ -0,0 +1,29 @@ +It looks like the problems with the git backend are more than just in the +site-init command. It looks like several places expect that git_dir_for_path +and git_repo_for_path return absolute paths, while in the current +implementation, it may not be the case. Here is an updated patch to fix this. +This replaces the previous patch that I gave in this bug. It seems to work for +me, but I haven't heavily tested it. + +--- libbe/git.py 2008-06-22 19:52:14.000000000 -0400 ++++ /libbe/git.py 2008-06-23 22:39:17.000000000 -0400 +@@ -102,11 +102,16 @@ + """Find the root of the deepest repository containing path.""" + # Assume that nothing funny is going on; in particular, that we aren't + # dealing with a bare repo. +- return os.path.dirname(git_dir_for_path(path)) ++ # "git rev-parse --show-cdup" gives the relative path to the top-level ++ # directory of the repository. We then join that to the requested path, ++ # and then use realpath to turn it into an absolute path and to get rid of ++ # ".." components. ++ return os.path.realpath(os.path.join(path,invoke_client("rev-parse", "--show-cdup", directory=path)[1].rstrip())) + + def git_dir_for_path(path): + """Find the git-dir of the deepest repo containing path.""" +- return invoke_client("rev-parse", "--git-dir", directory=path)[1].rstrip() ++ repo = git_repo_for_path(path) ++ return os.path.join(repo,invoke_client("rev-parse", "--git-dir", directory=repo)[1].rstrip()) + + def export(spec, bug_dir, revision_dir): + """Check out commit 'spec' from the git repo containing bug_dir into + diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/17a2217e-fc1d-4d7a-a569-4fd2a4a2261e/values b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/17a2217e-fc1d-4d7a-a569-4fd2a4a2261e/values new file mode 100644 index 0000000..1350ffb --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/17a2217e-fc1d-4d7a-a569-4fd2a4a2261e/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Tue, 24 Jun 2008 02:45:18 +0000 + + + + + + +From=hubert + + + diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/6a0080c4-d684-4c2c-afaa-c15cc43d68ad/body b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/6a0080c4-d684-4c2c-afaa-c15cc43d68ad/body new file mode 100644 index 0000000..c889a38 --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/6a0080c4-d684-4c2c-afaa-c15cc43d68ad/body @@ -0,0 +1 @@ +Fixed with a simpler patch. diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/6a0080c4-d684-4c2c-afaa-c15cc43d68ad/values b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/6a0080c4-d684-4c2c-afaa-c15cc43d68ad/values new file mode 100644 index 0000000..4a2e108 --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/6a0080c4-d684-4c2c-afaa-c15cc43d68ad/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Thu, 13 Nov 2008 19:31:04 +0000 + + + + + + +From=wking + + + diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/7e733393-8ba0-4345-a0e3-4140101d32f0/body b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/7e733393-8ba0-4345-a0e3-4140101d32f0/body new file mode 100644 index 0000000..7c07a0f --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/7e733393-8ba0-4345-a0e3-4140101d32f0/body @@ -0,0 +1,23 @@ +Oops, missed a case. I now see what Hubert was saying about absolute +paths :p. In git.strip_git(), the output of git_repo_for_path('.') +was being subtracted from an absolute path. Obviously, if the path +was returning '.', you'd get things like + +filename= +/home/wking/src/fun/testbe/.be/bugs/c3bf839b-88f9-4609-89a2-6a5b75c415b8/values + +stripping 2 chars ('.' and '/')], returns +ome/wking/src/fun/testbe/.be/bugs/c3bf839b-88f9-4609-89a2-6a5b75c415b8/values + + +Now we convert the git_repo_for_path output to an absolute path and get + +filename= +/home/wking/src/fun/testbe/.be/bugs/c3bf839b-88f9-4609-89a2-6a5b75c415b8/values +absRepoPath= +/home/wking/src/fun/testbe +absRepoSlashedDir= +/home/wking/src/fun/testbe/ +returns +.be/bugs/c3bf839b-88f9-4609-89a2-6a5b75c415b8/values + diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/7e733393-8ba0-4345-a0e3-4140101d32f0/values b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/7e733393-8ba0-4345-a0e3-4140101d32f0/values new file mode 100644 index 0000000..cbf7142 --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/7e733393-8ba0-4345-a0e3-4140101d32f0/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Thu, 13 Nov 2008 20:18:02 +0000 + + + + + + +From=wking + + + diff --git a/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/values b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/values new file mode 100644 index 0000000..970523c --- /dev/null +++ b/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/values @@ -0,0 +1,35 @@ + + + +creator=hubert + + + + + + +severity=minor + + + + + + +status=closed + + + + + + +summary=set-root in git repository fails + + + + + + +time=Mon, 23 Jun 2008 04:57:22 +0000 + + + |