git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 00/20] git-cvsserver: add support for cvs "-r" refs

From
MOMatthew Ogilvie <mmogilvi_git@miniinfo.net>
Date
Oct 14, 2012, 05:42 UTC
Message-ID
<1350193353-19210-1-git-send-email-mmogilvi_git@miniinfo.net>

This patch series improves git-cvsserver's handling and support of refspecs requested by the client.

Disclaimer: I don't actually intend to use any of this myself.
I suspect no one really cares about cvsserver (I don't even really
care myself).  See also below.

----------- Features: -----------

1. You can now switch branches with "cvs update -r REFSPEC",
   "cvs update -A", "cvs checkout -r ...", etc.  It becomes sticky for
   plain "cvs update" until reset (like standard CVS).  You can
   add/remove/commit to other branches updated this way.
      The old "cvs checkout moduleThatIsReallyABranch" technique
   still works; it becomes the main head branch from CVS's perspective.
   CVS revision number allocation is not synchronized between different
   modules checkout out in this old way.
2. You can create arbitrary diffs and patches with commands such as
   "cvs diff -r REFSPEC [-r REFSPEC]", over files, directories, or whole
   trees.  (It used to effectively be limited to individual files,
   and CVS-specific revision numbers (no tags).)
3. The REFSPECs can refer to CVS revision numbers, git commit IDs,
   git tags, git branches, or other git refspecs.  There is an escape
   mechanism you can use if your CVS client won't let you feed in
   invalid CVS tags that contain ".", "/", or similar characters.
4. No DB schema changes for now.  You can downgrade back to previous
   versions, and the only things that may break are existing sandboxes
   that were explicitly using the new features (had been set to a sticky
   branch with cvs update -r).

----------- Limitations: -----------

1. CVS revision numbers (other than those on the main
   branch) are not "real".  Instead, they are git commit ID's
   encoded to look like valid CVS revision numbers.  Subsequent versions
   do not have related CVS revision numbers at all.
   (Most of the code in this patch series would probably still be
   useful if someone enhances CVS revision numbers in the future.)
2. "CVS log" does not attempt to show versions on other than the "main"
   branch, even if a non-main branch is currently checked out.  It also
   doesn't show any branch or tag names.
3. Performance: When updating, it attempts to find a main-branch
   CVS revision number, or failing that, restrict itself to
   the specific git commit ID where the file most recently
   changed.  Searching for these (on an individual file
   basis) can currently be rather expensive, and probably
   doesn't scale well.  There are several possible ways it might be
   optimized, but no optimization has been done.  See comments in the
   patch.
4. I've done almost no testing, other than running both old and new
   unit tests (t9400, t9401, and t9402).
5. Testing Eclipse: I needed to make some changes to the
   details of what cvs update sends for the CVS protocol, even
   in the non-branch case.  I think I've made it closer to being
   the same as a standard CVS server (based on some captured
   conversations), but it still isn't "perfect".
   With luck, reputedly-finicky clients like Eclipse will still
   work correctly, but I haven't actually verified this.
6. Pre-existing issue: There are cases where the server will ask the
   client to replace user-modified files without saving those modifications
   off to the side first (.# files).  I haven't fixed these, but the fourth
   patch adds a comment about one such case.
7. Coding style: git-cvsserver mostly doesn't use git's main coding style.
   In fact, different parts of the file seem to use different
   coding styles.  I've made a superficial attempt to have each change
   keep relatively close to nearby coding style.  But larger chunks
   of code tend to stick to a hybrid of what seems most predominant
   in the file as a whole, and my own personally preferred style.

----------- Disclaimer: -----------

I don't actually intend to use any of this myself.

I started it a few years ago under the theory that a more accurate emulation of CVS would make it easier to convince the team at $DAYJOB to switch to git, but we eventually switched without using git-cvsserver at all. I've been working on this on and off (mostly off) out of a vague sense of stubborness.

Depending on overall interest in this feature (most likely not much) vs how many adjustments maintainers want, I might gradually get this into a ready-to-include state (possibly weeks or months). But my primary goal here is just to have it available publicly somewhere (like the mailing list) where someone who really wants features like these can use these patches as a starting point. That said, perhaps some of the trivial cleanup patches could go in now?

-------------------------------
Matthew Ogilvie (20):
  cvsserver t9400: add basic 'cvs log' test
  cvsserver: removed unused sha1Or-k mode from kopts_from_path
  cvsserver: add comments about database schema/usage
  cvsserver update: comment about how we shouldn't remove a
    user-modified file
  cvsserver: remove unused functions _headrev and gethistory
  cvsserver: clean up client request handler map comments
  cvsserver: split up long lines in req_{status,diff,log}
  cvsserver: use whole CVS rev number in-process; don't strip "1."
    prefix
  cvsserver: cvs add: do not expand directory arguments
  cvsserver status: provide real sticky info
  cvsserver: factor out git-log parsing logic
  cvsserver: cleanup extra slashes in filename arguments
  cvsserver: define a tag name character escape mechanism
  cvsserver: add misc commit lookup, file meta data, and file listing
    functions
  cvsserver: implement req_Sticky and related utilities
  cvsserver: generalize getmeta() to recognize commit refs
  cvsserver: Add version awareness to argsfromdir
  cvsserver: support -r and sticky tags for most operations
  cvsserver: add t9402 to test branch and tag refs
  cvsserver Documentation: new cvs ... -r support
 Documentation/git-cvsserver.txt |   37 +
 git-cvsserver.perl              | 2433 +++++++++++++++++++++++++++++++--------
 t/t9400-git-cvsserver-server.sh |   72 +-
 t/t9401-git-cvsserver-crlf.sh   |   35 +
 t/t9402-git-cvsserver-refs.sh   |  558 +++++++++
 5 files changed, 2624 insertions(+), 511 deletions(-)
 create mode 100755 t/t9402-git-cvsserver-refs.sh
-- 
1.7.10.2.484.gcd07cc5
Next: Matthew Ogilvie
Message 1 of 22 in “git-cvsserver: add support for cvs "-r" refs”
  1. 00/20 git-cvsserver: add support for cvs "-r" refsMatthew Ogilvie, Oct 14, 2012
  2. 01/20 cvsserver t9400: add basic 'cvs log' testMatthew Ogilvie, Oct 14, 2012
  3. 02/20 cvsserver: removed unused sha1Or-k mode from kopts_from_pathMatthew Ogilvie, Oct 14, 2012
  4. 03/20 cvsserver: add comments about database schema/usageMatthew Ogilvie, Oct 14, 2012
  5. 04/20 cvsserver update: comment about how we shouldn't remove a user-modified fileMatthew Ogilvie, Oct 14, 2012
  6. 05/20 cvsserver: remove unused functions _headrev and gethistoryMatthew Ogilvie, Oct 14, 2012
  7. 06/20 cvsserver: clean up client request handler map commentsMatthew Ogilvie, Oct 14, 2012
  8. 07/20 cvsserver: split up long lines in req_{status,diff,log}Matthew Ogilvie, Oct 14, 2012
  9. 08/20 cvsserver: use whole CVS rev number in-process; don't strip "1." prefixMatthew Ogilvie, Oct 14, 2012
  10. 09/20 cvsserver: cvs add: do not expand directory argumentsMatthew Ogilvie, Oct 14, 2012
  11. 10/20 cvsserver status: provide real sticky infoMatthew Ogilvie, Oct 14, 2012
  12. 11/20 cvsserver: factor out git-log parsing logicMatthew Ogilvie, Oct 14, 2012
  13. 12/20 cvsserver: cleanup extra slashes in filename argumentsMatthew Ogilvie, Oct 14, 2012
  14. 13/20 cvsserver: define a tag name character escape mechanismMatthew Ogilvie, Oct 14, 2012
  15. 14/20 cvsserver: add misc commit lookup, file meta data, and file listing functionsMatthew Ogilvie, Oct 14, 2012
  16. 15/20 cvsserver: implement req_Sticky and related utilitiesMatthew Ogilvie, Oct 14, 2012
  17. 16/20 cvsserver: generalize getmeta() to recognize commit refsMatthew Ogilvie, Oct 14, 2012
  18. 17/20 cvsserver: Add version awareness to argsfromdirMatthew Ogilvie, Oct 14, 2012
  19. 18/20 cvsserver: support -r and sticky tags for most operationsMatthew Ogilvie, Oct 14, 2012
  20. 19/20 cvsserver: add t9402 to test branch and tag refsMatthew Ogilvie, Oct 14, 2012
  21. 20/20 cvsserver Documentation: new cvs ... -r supportMatthew Ogilvie, Oct 14, 2012
  22. Junio C HamanoOct 16, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.