Submitter | Siddharth Agarwal |
---|---|
Date | Jan. 2, 2016, 11:25 a.m. |
Message ID | <d2b847835e055f08e538.1451733910@dev666.prn1.facebook.com> |
Download | mbox | patch |
Permalink | /patch/12474/ |
State | Accepted |
Delegated to: | Martin von Zweigbergk |
Headers | show |
Comments
On Sat, Jan 2, 2016 at 3:28 AM Siddharth Agarwal <sid0@fb.com> wrote: > # HG changeset patch > # User Siddharth Agarwal <sid0@fb.com> > # Date 1451733661 28800 > # Sat Jan 02 03:21:01 2016 -0800 > # Node ID d2b847835e055f08e538ecf3ad336b7a1cb57e30 > # Parent c1ad84b3d9c0cc4c80e8df426dc9d8bf4c4fc488 > # Available At http://42.netv6.net/sid0-wip/hg/ > # hg pull http://42.netv6.net/sid0-wip/hg/ -r d2b847835e05 > batchget: add support for backing up files > > We're going to use this in an upcoming feature. > > diff --git a/mercurial/merge.py b/mercurial/merge.py > --- a/mercurial/merge.py > +++ b/mercurial/merge.py > @@ -971,11 +971,26 @@ def batchget(repo, mctx, actions): > verbose = repo.ui.verbose > fctx = mctx.filectx > wwrite = repo.wwrite > + ui = repo.ui > i = 0 > for f, args, msg in actions: > repo.ui.debug(" %s: %s -> g\n" % (f, msg)) > if verbose: > repo.ui.note(_("getting %s\n") % f) > + > + if args[1]: # backup > I'll change this in flight so we deconstruct the tuple in the for loop declaration instead and get to name the members (i.e. "for f, (flags, backup), msg in actions:"). > + absf = repo.wjoin(f) > + orig = scmutil.origpath(ui, repo, absf) > This needs the "import scmutil" from patch 7/7. I'll fix it in flight. > + try: > + # TODO Mercurial has always aborted if an untracked > directory > + # is replaced by a tracked file, or generally with > + # file/directory merges. This needs to be sorted out. > + if repo.wvfs.isfileorlink(f): > + util.rename(absf, orig) > + except OSError as e: > + if e.errno != errno.ENOENT: > + raise > + > wwrite(f, fctx(f).data(), args[0]) > And I'll change this to use "flags" instead of "args[0]". > if i == 100: > yield i, f > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > https://selenic.com/mailman/listinfo/mercurial-devel >
Thanks for the fixes! On 1/5/16 22:33, Martin von Zweigbergk wrote: > > > On Sat, Jan 2, 2016 at 3:28 AM Siddharth Agarwal <sid0@fb.com > <mailto:sid0@fb.com>> wrote: > > # HG changeset patch > # User Siddharth Agarwal <sid0@fb.com <mailto:sid0@fb.com>> > # Date 1451733661 28800 > # Sat Jan 02 03:21:01 2016 -0800 > # Node ID d2b847835e055f08e538ecf3ad336b7a1cb57e30 > # Parent c1ad84b3d9c0cc4c80e8df426dc9d8bf4c4fc488 > # Available At http://42.netv6.net/sid0-wip/hg/ > # hg pull http://42.netv6.net/sid0-wip/hg/ -r > d2b847835e05 > batchget: add support for backing up files > > We're going to use this in an upcoming feature. > > diff --git a/mercurial/merge.py b/mercurial/merge.py > --- a/mercurial/merge.py > +++ b/mercurial/merge.py > @@ -971,11 +971,26 @@ def batchget(repo, mctx, actions): > verbose = repo.ui.verbose > fctx = mctx.filectx > wwrite = repo.wwrite > + ui = repo.ui > i = 0 > for f, args, msg in actions: > repo.ui.debug(" %s: %s -> g\n" % (f, msg)) > if verbose: > repo.ui.note(_("getting %s\n") % f) > + > + if args[1]: # backup > > > I'll change this in flight so we deconstruct the tuple in the for loop > declaration instead and get to name the members (i.e. "for f, (flags, > backup), msg in actions:"). > > + absf = repo.wjoin(f) > + orig = scmutil.origpath(ui, repo, absf) > > > This needs the "import scmutil" from patch 7/7. I'll fix it in flight. > > + try: > + # TODO Mercurial has always aborted if an > untracked directory > + # is replaced by a tracked file, or generally with > + # file/directory merges. This needs to be sorted out. > + if repo.wvfs.isfileorlink(f): > + util.rename(absf, orig) > + except OSError as e: > + if e.errno != errno.ENOENT: > + raise > + > wwrite(f, fctx(f).data(), args[0]) > > > And I'll change this to use "flags" instead of "args[0]". > > if i == 100: > yield i, f > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com <mailto:Mercurial-devel@selenic.com> > https://selenic.com/mailman/listinfo/mercurial-devel > > > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > https://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -971,11 +971,26 @@ def batchget(repo, mctx, actions): verbose = repo.ui.verbose fctx = mctx.filectx wwrite = repo.wwrite + ui = repo.ui i = 0 for f, args, msg in actions: repo.ui.debug(" %s: %s -> g\n" % (f, msg)) if verbose: repo.ui.note(_("getting %s\n") % f) + + if args[1]: # backup + absf = repo.wjoin(f) + orig = scmutil.origpath(ui, repo, absf) + try: + # TODO Mercurial has always aborted if an untracked directory + # is replaced by a tracked file, or generally with + # file/directory merges. This needs to be sorted out. + if repo.wvfs.isfileorlink(f): + util.rename(absf, orig) + except OSError as e: + if e.errno != errno.ENOENT: + raise + wwrite(f, fctx(f).data(), args[0]) if i == 100: yield i, f