devel: implement --retain-history option
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 10 Apr 2014 12:23:09 +0000 (15:23 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 10 Apr 2014 12:23:09 +0000 (15:23 +0300)
With this option defined gbs tries to preserve the history of the
changes (since upstream) doing a convert. Basically, for each commit in
the old branch a corresponding commit in the new orphan packaging branch
is created. This works by dumping packaging files and updating patches
for each commit.  However, empty commits are not generated - these are
caused e.g. by changes files that are ignored by patch-generation like
.gbs.conf.

NOTE! Only valid for the 'convert' action.

Change-Id: I669fa6732bea7940561f5c99820d6d97d14b0658
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gitbuildsys/cmd_devel.py
tools/gbs

index 09d1913..db5c5d7 100644 (file)
@@ -56,6 +56,8 @@ def compose_gbp_args(repo, tmp_dir, spec, args):
             "--patch-export-ignore-path=^(%s/.*|.gbs.conf)" % packaging_dir]
     if args.debug:
         argv.append("--verbose")
+    if args.retain_history:
+        argv.append("--retain-history")
 
     return argv
 
index 32c0c55..f4010f0 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -507,6 +507,10 @@ def devel_parser(parser):
                         help="upstream tag format, '${upstreamversion}' is "
                         'expanded to the version in the spec file. '
                         "E.g. 'v${upstreamversion}'")
+    parser.add_argument('--retain-history', action='store_true',
+                        help='Preserve as much of the git history as possible '
+                        'in the conversion, i.e. create one commit per commit. '
+                        'Only relevant for the convert action.')
     parser.add_argument('action', choices=['start', 'export', 'drop', 'switch',
                         'convert'],
                         help='Action to take')