i-d-template icon indicating copy to clipboard operation
i-d-template copied to clipboard

Setting "replaces" with automatic submission

Open cabo opened this issue 3 years ago • 5 comments

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?

cabo avatar May 19 '21 19:05 cabo

(Needs "low-prio", "WIBNI", "look-at-this-if-bored" labels, but I still wanted to document the issue.)

cabo avatar May 19 '21 19:05 cabo

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.

martinthomson avatar May 20 '21 00:05 martinthomson

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.

martinthomson avatar Sep 10 '21 06:09 martinthomson

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.

MikeBishop avatar Sep 10 '21 14:09 MikeBishop

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.

martinthomson avatar Sep 13 '21 00:09 martinthomson

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?

aaronpk avatar Dec 15 '22 17:12 aaronpk

It should. Did it work for you? I do need to update docs though...

martinthomson avatar Dec 15 '22 21:12 martinthomson

Okay I will try it next time. Unfortunately I published the last draft before I knew this existed.

aaronpk avatar Dec 15 '22 22:12 aaronpk