Search code examples
bashfossil

How to list all files of a Fossil repository, which have been deleted in the past?


How to list all files of a Fossil repository, which have been deleted in the past?

The only solution I can imagine is to do a ls for every revision in the timeline in order to perform a diff on sequenced outputs.

Is there any easier way?

The hard way:

#! /bin/bash
set -eu
prev_id=
fossil timeline -n 0 "$@" |
sed -n 's/^..:..:.. \[\([0-9a-f]*\)\] .*/\1/p' |
while read id; do
  if [ "$prev_id" ]; then
    diff <(fossil ls -r "$id" "$@"|sort) <(fossil ls -r "$prev_id" "$@"|sort) |
    egrep '^[<>]' |
    sed 's/^>/add/;s/^</del/' |
    sed "s/^/$id /"
  fi
  prev_id=$id
done

Solution

  • You can use:

    fossil sql "select name from filename"
    

    to list all filenames that ever existed in a repository.

    If you want only those that don't exist anymore, you have to exclude those that show up in fossil ls.