On Sat, May 12, 2012 at 06:24:26PM +0200, Daniel Dehennin wrote: > Daniel Dehennin <daniel.dehen...@baby-gnu.org> writes: > > > Daniel Dehennin <daniel.dehen...@baby-gnu.org> writes: > > > > Hello, > > > > [...] > > > >> I still don't know what to do with the "version not found error" > > > > With this new version of my patch, guess_snapshot_commit is called if > > the changelog was just created. > > > > The "version not found error" remains when there was no previous > > debian/changelog. > > > > For this case, we could find the merge-base between upstream tag/branch > > and HEAD. > > > > What do you think about that last idea? > > Here is a working patch, it needs some cleanup. > > Regards > > From a4a49ae814dca2cdbbe753951a728d4f2ca07fcf Mon Sep 17 00:00:00 2001 > From: Daniel Dehennin <daniel.dehen...@baby-gnu.org> > Date: Sat, 12 May 2012 18:00:04 +0200 > Subject: [PATCH] Use common ancestor between HEAD and upstream as "--since" > when creating new changelog. > > * gbp/scripts/dch.py (main): Add processing of upstream-tree and > upstream-branch options. > Find the common ancestor between current HEAD and latest upstream tag > or upstream branch. Avoid creating a second changelog entry when > snapshot was requested. > --- > gbp/scripts/dch.py | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py > index ccdac96..0309aa4 100644 > --- a/gbp/scripts/dch.py > +++ b/gbp/scripts/dch.py > @@ -359,6 +359,8 @@ def main(argv): > parser.add_option_group(custom_group) > > parser.add_boolean_config_file_option(option_name = "ignore-branch", > dest="ignore_branch") > + naming_group.add_config_file_option(option_name="upstream-tree", > dest="upstream_tree") > + naming_group.add_config_file_option(option_name="upstream-branch", > dest="upstream_branch") > naming_group.add_config_file_option(option_name="debian-branch", > dest="debian_branch") > naming_group.add_config_file_option(option_name="upstream-tag", > dest="upstream_tag") > naming_group.add_config_file_option(option_name="debian-tag", > dest="debian_tag") > @@ -443,8 +445,22 @@ def main(argv): > else: > gbp.log.info("Couldn't find snapshot header, using > version info") > if not since: > - # FIXME: When creating a new package: find merge base > between HEAD and origin > - since = repo.find_version(options.debian_tag, cp['Version']) > + # Take care of newly created debian/changelog > + if hasattr(cp, 'first') and cp.first:
Hmm...where is first being set? I cloned git://git.baby-gnu.org/git-buildpackage tags/dad/create-inexistant-changelog/rebasable/on-f495df9-1 and couldn't find it at a first glance. > + pattern = options.upstream_tag % dict(version='*') > + try: > + upstream = repo.find_tag('HEAD', pattern=pattern) > + except GitRepositoryError: > + gbp.debug('No upstream tag found') > + upstream = options.upstream_branch > + if options.upstream_tree == 'branch': > + upstream = options.upstream_branch > + since = repo.get_merge_base('HEAD', upstream) Need to catch exception if no merge base is found. > + if since and options.snapshot: > + # Snapshot can not be guessed > + found_snapshot_header = True > + else: > + since = repo.find_version(options.debian_tag, > cp['Version']) > if not since: > raise GbpError, "Version %s not found" % cp['Version'] Cheers, -- Guido > > -- > 1.7.10 > > > -- > Daniel Dehennin > Récupérer ma clef GPG: > gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org