repo download: add --ff-only option

Allows to ff-only a gerrit patch
This patch is necessary to automatically ensure that the patch will
be correctly submitted on ff-only gerrit projects

You can now use:
repo download (--ff-only|-f) project changeid/patchnumber

This is useful to automate verification of fast forward status of a patch
in the context of build automation, and commit gating (e.g. buildbot)

Change-Id: I403a667557a105411a633e62c8eec23d93724b43
Signed-off-by: Erwan Mahe <erwan.mahe@intel.com>
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
diff --git a/subcmds/download.py b/subcmds/download.py
index f79f485..0ea45c3 100644
--- a/subcmds/download.py
+++ b/subcmds/download.py
@@ -39,6 +39,9 @@
     p.add_option('-r','--revert',
                  dest='revert', action='store_true',
                  help="revert instead of checkout")
+    p.add_option('-f','--ff-only',
+                 dest='ffonly', action='store_true',
+                 help="force fast-forward merge")
 
   def _ParseChangeIds(self, args):
     if not args:
@@ -87,5 +90,7 @@
         project._CherryPick(dl.commit)
       elif opt.revert:
         project._Revert(dl.commit)
+      elif opt.ffonly:
+        project._FastForward(dl.commit, ffonly=True)
       else:
         project._Checkout(dl.commit)