-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emacs isn't resyncing its internal vc state after a commit-patch commit #14
Comments
My memory is that the revert buffer stuff was from back before commit-patch supported anything other than CVS. It's specifically because our CVS files had CVS keywords in them—on commit CVS would change the file on disk to update version numbers and even add commit logs (in comments at the end of our C files). So the point of this code was to do a real revert so the emacs buffer would match what was on the disk. I think at least SVN can do that same keyword stuff. I doubt any of the distributed ones do it (though maybe BZR—it's strange). But—it does use |
Bug ping. This is still a problem. Are either of you still using this? I am, and it's constantly bugging me. If you're all done with this thing, please tell me, and I'll fix it myself. Thanks! |
I still use this every day—it probably accounts for 99% of commits I make. However, I never use I looks like it might be as simple as adding
Can you try that locally and see if it fixes your issue? |
David Caldwell ***@***.***> writes:
I looks like it might be as simple as adding `'reset-vc-info` to the
`vc-resynch-buffer` call:
(vc-resynch-buffer (buffer-file-name buf) 'revert 'noquery 'reset-vc-info)
Can you try that locally and see if it fixes your issue?
Nope. I updated commit-patch-buffer-in-directory with the change,
re-evaled. Then made an arbitrary commit to a file. Then
(vc-file-getprop (buffer-file-name) 'vc-working-revision)
I still see the old revision, pre-commit. If I, for instance,
(revert-buffer), then I see the new revision.
|
I think I found the issue. It was staring me in the face with the message that comes up on every commit:
That "reverted 0" shows that it isn't actually hitting any of that revert code. The crux seems to be when we go looking for buffers earlier in the code. There were 2 things:
I'm not sure how 2 ever worked? Maybe
With that (and without the |
I like how much this message echoes the original bug report :)
I just tested the patch, and it works for me now. Thanks a lot for
fixing it! Ping me when you need to push to Debian.
|
Lol, I apparently can't read. My eyes must have been drawn to the |
This feels like it's probably a regression, but I'm not sure. Problematic behavior I observe:
Open some version-controlled file in emacs. I'm using git; probably this doesn't matter
(vc-working-revision buffer-file-name) should return either HEAD or maybe the most recent revision of that one file. Either is fine
make a change to that file, commit it with commit-patch.
(vc-working-revision buffer-file-name) SHOULD now return the new revision but it doesn't for me. This being out-of-date makes vc-annotate and vc-log and others lie to you.
It looks like commit-patch tries to deal with this, but it's broken currently. I'm not patching it because I'd like to know what the intent was, and what you THINK it's doing.
Currently commit-patch-buffer-in-directory looks at the patch buffer, extracts a list of filenames in the patch, and tries to re-synchronize them with emacs. It does this by invoking "lsdiff" on the patch and parsing the output. Problem is, the patch often contains relative paths, so the patch-files variable ends up with strings like "a/file1.c", where "a" isn't a real directory, so the (find-buffer-visiting) call doesn't find the relevant buffer. The code is there. Did this ever work?
If we found a buffer, we'd do this for each one:
The comment implies that only CVS is affected, but it's all VCSs I'm guessing. At least in this case (vc-resync-buffer) doesn't fix this, but the (run-hooks) call does. The specific call that we need is (vc-file-clearprops buffer-file-name). Maybe we don't need to run ALL the hooks, but you can decide that.
Maybe vc-resynch-buffer should do the vc-clearprops.
The text was updated successfully, but these errors were encountered: