Try to restore group even when not root.

Normal users can't set the uid to a user other than themselves, but
they can set the group id if they are in that group.  Previously it
was ignoring uid and gid if it wasn't root, update to not change the
uid if not root and try to set the gid, ignoring any errors.

This also makes some improvements to the metadata_tests.  Make sure
magic uid and gid isn't the current user.  Expand fake_lchown to use
-1 as don't update that UID for the above group restore tests to pass.
Create oserror_lchown for code coverage to exercise the error path.
test_does_not_set_uid_when_not_running_as_root was using fake_lchown,
but checking the actual file, which would normally be owned by the
user that just created it, so it wasn't an effective test.
test_does_not_set_gid_when_not_running_as_root no longer applies, as
it does try to set the group.  Add a test for lchown set failure, and
a test to verify it actually sets the file to every group the user is
in.
store and restore character and block special device node numbers

Character and block special devices were restored with 0, 0 as the
major and minor numbers causing them to be unusable.  Without which a
system backup and restore would leave the system unbootable.  The
major and minor numbers are saved at the end of the metadata so as to
make the repository format backwards compatible.
fill in the mode display bits

This fills in the displayed file mode permission mode bits such as
character, block, setuid, sticky, etc.
cat optimization, only get toplevel when running filters

It isn't used if the data is being returned unmodified.
add option 'ssh-options' to pass options to ssh

From: Lars Wirzenius <liw@liw.fi>
Date: Sat, 23 Feb 2013 18:53:12 +0000
Subject: Re: [PATCH] add option 'ssh-options' to add ssh command line
options

"
This requires that Obnam parses the options so that it can pass
them onto ssh. Such parsing is either quite complicated (when it
emulates the way the shell does it), or prone to be surprising
to users. Your patch is of the latter kind, and will cause
surprises when the ssh options need to include spaces.

If you rework the patch to use cliapp's string list setting
type, the user can give each ssh option as a separate Obnam
option, and embedded spaces will work. This would be a much
cleaner solution.

Such options also only affect the SFTP transfers when an
underlying ssh binary is used, but not when a pure Paramiko
is used. However, I can live with that.

As an aside, for bandwidth limiting, trickle(1) seems to be a nice,
generic option.
"
Are any exceptions expected, if not they need to be known
fix backup_plugin.py error unlocking order

unlock_client requires lock_shared to already be held.  Get it before
calling unlock_client if it isn't already held.
.gitignore add files to ignore
close VirtualFileSystem before closing sftp

For an easy demonstration of problems, back up to an sftp repository,
but then give an invalid backup directory, without the lockmgr updates
it would have left locks, with the lockmgr changes it crashes still
leaving the locks, because the force_unlock_all was being called
after the sftp repository was closed so it couldn't clean up the
locks.  Moved it to before.
print ssh connector bytes read or written
part one of moving send/recv_bytes to vfs
improve locking reporting

Let the user know when the backup is being blocked by a lock as it is
useful to warn the user as soon as possible that there might be a
problem, especially when the back just started otherwise they might go
on to something else thinking it is working.

Use unix line endings for the lock file, include the date, and print
the contents when a lock timeout happens.  Having the date is useful
to have an idea just how long the lock has been sitting there and if
it is safe to force remove it.
Don't leave locks around when interrupted.

If backup or fsck were interrupted with Control-C or a program
exception the repository locks would be left in place.  In this change
the lock manager keeps track of all out standing locks and fs.close()
will call into the lock manager to cleanup those locks, which is safe
as long as there are no more writes.  This catches exceptions in
backup and fsck plugins to call fs.close().  Idealy there would never
be any locks to cleanup, but if interrupted there are.

Not cleaning up the locks means automated backups are most likely
blocked, adn running force-lock can be dangerous because if another
client is actively backing up it will continue, but without the locks
it put in place.
lockmgr only do something if there are outstanding locks
get lockmgr_tests to pass now that lockmgr has been updated