D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 4392.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1656?vs=4390=4392

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

AFFECTED FILES
  contrib/synthrepo.py

CHANGE DETAILS

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -369,14 +369,14 @@
 while not validpath(path):
 path = pickpath()
 data = '%s contents\n' % path
-files[path] = context.memfilectx(repo, path, data)
+files[path] = data
 dir = os.path.dirname(path)
 while dir and dir not in dirs:
 dirs.add(dir)
 dir = os.path.dirname(dir)
 
 def filectxfn(repo, memctx, path):
-return files[path]
+return context.memfilectx(repo, path, files[path])
 
 ui.progress(_synthesizing, None)
 message = 'synthesized wide repo with %d files' % (len(files),)
@@ -444,14 +444,12 @@
 for __ in xrange(add):
 lines.insert(random.randint(0, len(lines)), makeline())
 path = fctx.path()
-changes[path] = context.memfilectx(repo, path,
-   '\n'.join(lines) + '\n')
+changes[path] = '\n'.join(lines) + '\n'
 for __ in xrange(pick(filesremoved)):
 path = random.choice(mfk)
 for __ in xrange(10):
 path = random.choice(mfk)
 if path not in changes:
-changes[path] = None
 break
 if filesadded:
 dirs = list(pctx.dirs())
@@ -466,9 +464,11 @@
 pathstr = '/'.join(filter(None, path))
 data = '\n'.join(makeline()
  for __ in xrange(pick(linesinfilesadded))) + '\n'
-changes[pathstr] = context.memfilectx(repo, pathstr, data)
+changes[pathstr] = data
 def filectxfn(repo, memctx, path):
-return changes[path]
+if path not in changes:
+return None
+return context.memfilectx(repo, path, changes[path])
 if not changes:
 continue
 if revs:



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


D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-12 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Crud. I had an old version of this queued, and failed to drop it. Fixing 
now...

REPOSITORY
  rHG Mercurial

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

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


D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-12 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
martinvonz marked an inline comment as done.
Closed by commit rHG304179b21bff: synthrepo: create filectx instance in 
filectxfn callback (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D1656?vs=4380=4390#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1656?vs=4380=4390

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

AFFECTED FILES
  contrib/synthrepo.py

CHANGE DETAILS

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -369,14 +369,14 @@
 while not validpath(path):
 path = pickpath()
 data = '%s contents\n' % path
-files[path] = context.memfilectx(repo, path, data)
+files[path] = data
 dir = os.path.dirname(path)
 while dir and dir not in dirs:
 dirs.add(dir)
 dir = os.path.dirname(dir)
 
 def filectxfn(repo, memctx, path):
-return files[path]
+return context.memfilectx(repo, path, files[path])
 
 ui.progress(_synthesizing, None)
 message = 'synthesized wide repo with %d files' % (len(files),)



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


D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 4380.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1656?vs=4364=4380

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

AFFECTED FILES
  contrib/synthrepo.py

CHANGE DETAILS

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -369,14 +369,14 @@
 while not validpath(path):
 path = pickpath()
 data = '%s contents\n' % path
-files[path] = context.memfilectx(repo, path, data)
+files[path] = data
 dir = os.path.dirname(path)
 while dir and dir not in dirs:
 dirs.add(dir)
 dir = os.path.dirname(dir)
 
 def filectxfn(repo, memctx, path):
-return files[path]
+return context.memfilectx(repo, path, files[path])
 
 ui.progress(_synthesizing, None)
 message = 'synthesized wide repo with %d files' % (len(files),)
@@ -444,14 +444,12 @@
 for __ in xrange(add):
 lines.insert(random.randint(0, len(lines)), makeline())
 path = fctx.path()
-changes[path] = context.memfilectx(repo, path,
-   '\n'.join(lines) + '\n')
+changes[path] = '\n'.join(lines) + '\n'
 for __ in xrange(pick(filesremoved)):
 path = random.choice(mfk)
 for __ in xrange(10):
 path = random.choice(mfk)
 if path not in changes:
-changes[path] = None
 break
 if filesadded:
 dirs = list(pctx.dirs())
@@ -466,9 +464,11 @@
 pathstr = '/'.join(filter(None, path))
 data = '\n'.join(makeline()
  for __ in xrange(pick(linesinfilesadded))) + '\n'
-changes[pathstr] = context.memfilectx(repo, pathstr, data)
+changes[pathstr] = data
 def filectxfn(repo, memctx, path):
-return changes[path]
+if path not in changes:
+return None
+return context.memfilectx(repo, path, changes[path])
 if not changes:
 continue
 if revs:



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


D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz marked an inline comment as done.
martinvonz added inline comments.

INLINE COMMENTS

> yuja wrote in synthrepo.py:453
> Perhaps filectxfn() should return None in this case.

Oops, good catch.

REPOSITORY
  rHG Mercurial

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

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


D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-12 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> synthrepo.py:453
>  if path not in changes:
>  changes[path] = None
>  break

Perhaps filectxfn() should return None in this case.

REPOSITORY
  rHG Mercurial

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

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


D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-11 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 4364.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1656?vs=4354=4364

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

AFFECTED FILES
  contrib/synthrepo.py

CHANGE DETAILS

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -369,14 +369,14 @@
 while not validpath(path):
 path = pickpath()
 data = '%s contents\n' % path
-files[path] = context.memfilectx(repo, path, data)
+files[path] = data
 dir = os.path.dirname(path)
 while dir and dir not in dirs:
 dirs.add(dir)
 dir = os.path.dirname(dir)
 
 def filectxfn(repo, memctx, path):
-return files[path]
+return context.memfilectx(repo, path, files[path])
 
 ui.progress(_synthesizing, None)
 message = 'synthesized wide repo with %d files' % (len(files),)
@@ -444,8 +444,7 @@
 for __ in xrange(add):
 lines.insert(random.randint(0, len(lines)), makeline())
 path = fctx.path()
-changes[path] = context.memfilectx(repo, path,
-   '\n'.join(lines) + '\n')
+changes[path] = '\n'.join(lines) + '\n'
 for __ in xrange(pick(filesremoved)):
 path = random.choice(mfk)
 for __ in xrange(10):
@@ -466,9 +465,11 @@
 pathstr = '/'.join(filter(None, path))
 data = '\n'.join(makeline()
  for __ in xrange(pick(linesinfilesadded))) + '\n'
-changes[pathstr] = context.memfilectx(repo, pathstr, data)
+changes[pathstr] = data
 def filectxfn(repo, memctx, path):
-return changes[path]
+if path not in changes:
+return None
+return context.memfilectx(repo, path, changes[path])
 if not changes:
 continue
 if revs:



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


D1656: synthrepo: create filectx instance in 'filectxfn' callback

2017-12-11 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I would like to pass the memctx to the memfilectx constructor, but
  it's not available where we currently create the memfilectx. It is
  available in the 'filectxfn' callback, so let's create the memfilectx
  there instead. A later patch will start actually passing the memctx.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/synthrepo.py

CHANGE DETAILS

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -369,14 +369,14 @@
 while not validpath(path):
 path = pickpath()
 data = '%s contents\n' % path
-files[path] = context.memfilectx(repo, path, data)
+files[path] = data
 dir = os.path.dirname(path)
 while dir and dir not in dirs:
 dirs.add(dir)
 dir = os.path.dirname(dir)
 
 def filectxfn(repo, memctx, path):
-return files[path]
+return context.memfilectx(repo, path, files[path])
 
 ui.progress(_synthesizing, None)
 message = 'synthesized wide repo with %d files' % (len(files),)



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