diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-11-28 10:43:20 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-06-06 14:42:21 +0200 |
commit | 74d956fbece3d7ecb667855d7c9f194c4563ab20 (patch) | |
tree | 7aac7a8d200b5c2b0db28fc4c3a52966181fb4ad /gbp/scripts | |
parent | f717975c6002ded7cf6a00719d05cb9ef66b67c5 (diff) |
import-orig: keep working copy in sync with branch HEAD
Update working copy and index (to branch HEAD) if we modify the
currently checked-out branch. Otherwise the repository is left in
unclean state when the current branch is upstream or pristine-tar and
the '--no-merge' option is used.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/scripts')
-rw-r--r-- | gbp/scripts/import_orig.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py index d082496..e28d750 100644 --- a/gbp/scripts/import_orig.py +++ b/gbp/scripts/import_orig.py @@ -357,6 +357,12 @@ def main(argv): info = { 'version': "%s%s-1" % (epoch, version) } env = { 'GBP_BRANCH': options.debian_branch } gbpc.Command(options.postimport % info, extra_env=env, shell=True)() + # Update working copy and index if we've possibly updated the + # checked out branch + current_branch = repo.get_branch() + if (current_branch == options.upstream_branch or + current_branch == repo.pristine_tar_branch): + repo.force_head(current_branch, hard=True) except (gbpc.CommandExecFailed, GitRepositoryError) as err: msg = err.__str__() if len(err.__str__()) else '' raise GbpError("Import of %s failed: %s" % (source.path, msg)) |