jimp
jimp

Reputation: 17477

How do I get a list of closed/deleted Subversion branches across all revisions?

How would I get a listing of all Subversion branches that have ever existed in a repository? For example, the contents of the /branches folder holds active/open branches, but how would I list branches under that path that have been closed (deleted) before the HEAD revision? Sometimes I want to review some work I did specifically in an old retired branch, but I cannot remember the revision range to locate it very easily.

Upvotes: 2

Views: 615

Answers (1)

jimp
jimp

Reputation: 17477

I wrote a "quick" one-liner to iterate over a Subversion repo URL range, sort, and remove the duplicates. The output of svn help ls says a revision range is not allowed, so I think this might be the only way to list the past.

R1=1; R2=7; URL="https://.../branches" \
OUTPUT=""; \
for (( REV=$R1; REV<=$R2; ++REV )); do \
  echo "Processing revision $REV"; \
  OUTPUT="$OUTPUT\n$(svn ls $URL -r$REV 2>/dev/null;)"; \
done; \
echo -e "$OUTPUT" | sort | uniq | sed -e 's/\/$//';

Example output:

Processing revision 1
Processing revision 2
Processing revision 3
Processing revision 4
Processing revision 5
Processing revision 6
Processing revision 7

branch-deleted-in-r2
branch-deleted-in-r5
branch-stale-but-still-alive
some-branch-removed-r5
some-current-branch

Upvotes: 2

Related Questions