Mercurial > hg > hg-git
changeset 297:a90fe3e8a8c3
hggit: defend against exceptions when pulling with -r
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Thu, 25 Mar 2010 20:23:00 -0500 |
parents | 32456f9cb7a4 |
children | 6ad6945b6629 |
files | hggit/__init__.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -55,6 +55,14 @@ return hgdefaultdest(source) hg.defaultdest = defaultdest +# defend against tracebacks if we specify -r in 'hg pull' +def safebranchrevs(orig, lrepo, repo, branches, revs): + revs, co = orig(lrepo, repo, branches, revs) + if getattr(lrepo, 'changelog', False) and co not in lrepo.changelog: + co = None + return revs, co +extensions.wrapfunction(hg, 'addbranchrevs', safebranchrevs) + def reposetup(ui, repo): if not isinstance(repo, gitrepo.gitrepo): klass = hgrepo.generate_repo_subclass(repo.__class__)