i-d-template
i-d-template copied to clipboard
Setting "replaces" with automatic submission
make tag -s draft-ietf-rats-uccs-00 git push origin draft-ietf-rats-uccs-00
worked great, but where to put the "replaces" info?
(Needs "low-prio", "WIBNI", "look-at-this-if-bored" labels, but I still wanted to document the issue.)
Right; I have had this on my todo list for some time. I would have done it if not for the fact that the API doesn't support it. Working out what to put in for replaces is some work, but I think that I know how to do it, provided that git correctly captures the rename.
Opened https://trac.ietf.org/trac/ietfdb/ticket/3286#ticket for this.
Git doesn't really track renames that well, but we might be able to approximate it.
git log --follow --name-status --format=format: -- "$file" | sed -e '/^$/d' | cut -f 2 | uniq | tail +2
might be useful. It runs through the log and (by omitting actual log with --format
and adding --name-status
) prints out all names that a file has had. It then cuts blank lines, pulls out the original filename from the status information, collapses duplicates, and skips the first value (the current filename). Pick the most recent (git tag --sort='-*authordate' --list $(for n in "${old_names[@]}; do echo "${n%.*}-*'; done)
), and use that as the tag.
I suspect it also matters whether the file is properly renamed within git (git mv oldfile.md newfile.md
) or is simply deleted and a new file with strikingly similar content is added.
What I learned from looking at this was that git doesn't have any innate concept of renaming. git mv
is pure sugar that does something like git rm oldfile.md;mv oldfile.md newfile.md; git add newfile.md
. What you see reported as moves are also complete fabrications. git matches files that have been deleted with those that have been created using a heuristic (with a default 50% similarity). If they are similar enough, it reports that as a move. The heuristic can be tweaked using the -M
option on git log
, the documentation which also explains what is going on.
I just found this issue after mistakenly forgetting to manually upload a draft last week so that I could mark it as replacing an individual draft. I can't find any reference to this in the docs though, does this feature exist in this project and the datatracker API now?
It should. Did it work for you? I do need to update docs though...
Okay I will try it next time. Unfortunately I published the last draft before I knew this existed.