D4588: py3: fix kwargs handling in hgext/fastannotate.py

2018-09-18 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb77f2ea51da5: py3: fix kwargs handling in 
hgext/fastannotate.py (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4588?vs=11101=11139

REVISION DETAIL
  https://phab.mercurial-scm.org/D4588

AFFECTED FILES
  hgext/fastannotate/commands.py

CHANGE DETAILS

diff --git a/hgext/fastannotate/commands.py b/hgext/fastannotate/commands.py
--- a/hgext/fastannotate/commands.py
+++ b/hgext/fastannotate/commands.py
@@ -130,6 +130,8 @@
 if ui.configbool('fastannotate', 'unfilteredrepo'):
 repo = repo.unfiltered()
 
+opts = pycompat.byteskwargs(opts)
+
 rev = opts.get('rev', '.')
 rebuild = opts.get('rebuild', False)
 
@@ -207,12 +209,12 @@
 
 # treat the file as text (skip the isbinary check)
 if ui.configbool('fastannotate', 'forcetext'):
-opts['text'] = True
+opts[r'text'] = True
 
 # check if we need to do prefetch (client-side)
-rev = opts.get('rev')
+rev = opts.get(r'rev')
 if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
-paths = list(_matchpaths(repo, rev, pats, opts))
+paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts)))
 repo.prefetchfastannotate(paths)
 
 return orig(ui, repo, *pats, **opts)
@@ -241,6 +243,7 @@
 The annotate cache will be built using the default diff and follow
 options and lives in '.hg/fastannotate/default'.
 """
+opts = pycompat.byteskwargs(opts)
 rev = opts.get('REV') or ui.config('fastannotate', 'mainbranch')
 if not rev:
 raise error.Abort(_('you need to provide a revision'),



To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4588: py3: fix kwargs handling in hgext/fastannotate.py

2018-09-16 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 11101.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4588?vs=11042=11101

REVISION DETAIL
  https://phab.mercurial-scm.org/D4588

AFFECTED FILES
  hgext/fastannotate/commands.py

CHANGE DETAILS

diff --git a/hgext/fastannotate/commands.py b/hgext/fastannotate/commands.py
--- a/hgext/fastannotate/commands.py
+++ b/hgext/fastannotate/commands.py
@@ -130,6 +130,8 @@
 if ui.configbool('fastannotate', 'unfilteredrepo'):
 repo = repo.unfiltered()
 
+opts = pycompat.byteskwargs(opts)
+
 rev = opts.get('rev', '.')
 rebuild = opts.get('rebuild', False)
 
@@ -207,12 +209,12 @@
 
 # treat the file as text (skip the isbinary check)
 if ui.configbool('fastannotate', 'forcetext'):
-opts['text'] = True
+opts[r'text'] = True
 
 # check if we need to do prefetch (client-side)
-rev = opts.get('rev')
+rev = opts.get(r'rev')
 if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
-paths = list(_matchpaths(repo, rev, pats, opts))
+paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts)))
 repo.prefetchfastannotate(paths)
 
 return orig(ui, repo, *pats, **opts)
@@ -241,6 +243,7 @@
 The annotate cache will be built using the default diff and follow
 options and lives in '.hg/fastannotate/default'.
 """
+opts = pycompat.byteskwargs(opts)
 rev = opts.get('REV') or ui.config('fastannotate', 'mainbranch')
 if not rev:
 raise error.Abort(_('you need to provide a revision'),



To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4588: py3: fix kwargs handling in hgext/fastannotate.py

2018-09-16 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> indygreg wrote in commands.py:212-217
> Shouldn't we be doing the ``pycompat.byteskwargs()` at the beginning of the 
> function and using regular string literals on the keys we set?

We can do that, but then in the end we have to do `pycompat.strkwargs()` again 
to pass into orig() into line 220 below. So I am preventing a conversion here 
is rev is None.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4588

To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4588: py3: fix kwargs handling in hgext/fastannotate.py

2018-09-14 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> commands.py:212-217
> +opts[r'text'] = True
>  
>  # check if we need to do prefetch (client-side)
> -rev = opts.get('rev')
> +rev = opts.get(r'rev')
>  if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
> +paths = list(_matchpaths(repo, rev, pats, 
> pycompat.byteskwargs(opts)))

Shouldn't we be doing the ``pycompat.byteskwargs()` at the beginning of the 
function and using regular string literals on the keys we set?

> commands.py:246-257
> +rev = opts.get(r'REV') or ui.config('fastannotate', 'mainbranch')
>  if not rev:
>  raise error.Abort(_('you need to provide a revision'),
>hint=_('set fastannotate.mainbranch or use --rev'))
>  if ui.configbool('fastannotate', 'unfilteredrepo'):
>  repo = repo.unfiltered()
>  ctx = scmutil.revsingle(repo, rev)

Ditto.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4588

To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4588: py3: fix kwargs handling in hgext/fastannotate.py

2018-09-14 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4588

AFFECTED FILES
  hgext/fastannotate/commands.py

CHANGE DETAILS

diff --git a/hgext/fastannotate/commands.py b/hgext/fastannotate/commands.py
--- a/hgext/fastannotate/commands.py
+++ b/hgext/fastannotate/commands.py
@@ -130,6 +130,8 @@
 if ui.configbool('fastannotate', 'unfilteredrepo'):
 repo = repo.unfiltered()
 
+opts = pycompat.byteskwargs(opts)
+
 rev = opts.get('rev', '.')
 rebuild = opts.get('rebuild', False)
 
@@ -207,12 +209,12 @@
 
 # treat the file as text (skip the isbinary check)
 if ui.configbool('fastannotate', 'forcetext'):
-opts['text'] = True
+opts[r'text'] = True
 
 # check if we need to do prefetch (client-side)
-rev = opts.get('rev')
+rev = opts.get(r'rev')
 if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
-paths = list(_matchpaths(repo, rev, pats, opts))
+paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts)))
 repo.prefetchfastannotate(paths)
 
 return orig(ui, repo, *pats, **opts)
@@ -241,18 +243,18 @@
 The annotate cache will be built using the default diff and follow
 options and lives in '.hg/fastannotate/default'.
 """
-rev = opts.get('REV') or ui.config('fastannotate', 'mainbranch')
+rev = opts.get(r'REV') or ui.config('fastannotate', 'mainbranch')
 if not rev:
 raise error.Abort(_('you need to provide a revision'),
   hint=_('set fastannotate.mainbranch or use --rev'))
 if ui.configbool('fastannotate', 'unfilteredrepo'):
 repo = repo.unfiltered()
 ctx = scmutil.revsingle(repo, rev)
-m = scmutil.match(ctx, pats, opts)
+m = scmutil.match(ctx, pats, pycompat.byteskwargs(opts))
 paths = list(ctx.walk(m))
 if util.safehasattr(repo, 'prefetchfastannotate'):
 # client
-if opts.get('REV'):
+if opts.get(r'REV'):
 raise error.Abort(_('--rev cannot be used for client'))
 repo.prefetchfastannotate(paths)
 else:



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel