Patchwork export: export working directory parent by default

login
register
mail settings
Submitter Mads Kiilerich
Date April 11, 2013, 8:38 p.m.
Message ID <67c827fdb3f6e42c261d.1365712726@mk-desktop>
Download mbox | patch
Permalink /patch/1283/
State Superseded
Commit 1a9ad84583ee76365c334bf3337d3ec828c506aa
Headers show

Comments

Mads Kiilerich - April 11, 2013, 8:38 p.m.
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1360539792 -3600
#      Mon Feb 11 00:43:12 2013 +0100
# Node ID 67c827fdb3f6e42c261d50571acbde34ddde45e2
# Parent  027e7edd2707aba417c22fc9bf813d73ef54f6ea
export: export working directory parent by default

A common usecase for export is to preview the patch that will be patchbombed or
to see what changed in a revision found by bisect. Showing the working
directory parent is thus a useful and obvious default.
Pierre-Yves David - April 11, 2013, 10:49 p.m.
On 11 avr. 2013, at 22:38, Mads Kiilerich wrote:

> # HG changeset patch
> # User Mads Kiilerich <mads@kiilerich.com>
> # Date 1360539792 -3600
> #      Mon Feb 11 00:43:12 2013 +0100
> # Node ID 67c827fdb3f6e42c261d50571acbde34ddde45e2
> # Parent  027e7edd2707aba417c22fc9bf813d73ef54f6ea
> export: export working directory parent by default
> 
> A common usecase for export is to preview the patch that will be patchbombed or
> to see what changed in a revision found by bisect. Showing the working
> directory parent is thus a useful and obvious default.

Sounds like a decent default behavior. But you have to update the help too.
Augie Fackler - April 12, 2013, 8:34 p.m.
On Fri, Apr 12, 2013 at 12:49:43AM +0200, Pierre-Yves David wrote:
>
> On 11 avr. 2013, at 22:38, Mads Kiilerich wrote:
>
> > # HG changeset patch
> > # User Mads Kiilerich <mads@kiilerich.com>
> > # Date 1360539792 -3600
> > #      Mon Feb 11 00:43:12 2013 +0100
> > # Node ID 67c827fdb3f6e42c261d50571acbde34ddde45e2
> > # Parent  027e7edd2707aba417c22fc9bf813d73ef54f6ea
> > export: export working directory parent by default
> >
> > A common usecase for export is to preview the patch that will be patchbombed or
> > to see what changed in a revision found by bisect. Showing the working
> > directory parent is thus a useful and obvious default.
>
> Sounds like a decent default behavior. But you have to update the help too.

I'm not so sure. Why is this good in a way that 'hg diff' isn't for
uncommitted work?

>
> --
> Pierre-Yves
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - April 12, 2013, 10:44 p.m.
On Fri, 2013-04-12 at 16:34 -0400, Augie Fackler wrote:
> On Fri, Apr 12, 2013 at 12:49:43AM +0200, Pierre-Yves David wrote:
> >
> > On 11 avr. 2013, at 22:38, Mads Kiilerich wrote:
> >
> > > # HG changeset patch
> > > # User Mads Kiilerich <mads@kiilerich.com>
> > > # Date 1360539792 -3600
> > > #      Mon Feb 11 00:43:12 2013 +0100
> > > # Node ID 67c827fdb3f6e42c261d50571acbde34ddde45e2
> > > # Parent  027e7edd2707aba417c22fc9bf813d73ef54f6ea
> > > export: export working directory parent by default
> > >
> > > A common usecase for export is to preview the patch that will be patchbombed or
> > > to see what changed in a revision found by bisect. Showing the working
> > > directory parent is thus a useful and obvious default.
> >
> > Sounds like a decent default behavior. But you have to update the help too.
> 
> I'm not so sure. Why is this good in a way that 'hg diff' isn't for
> uncommitted work?

The proposal here is 'hg export' == 'hg export .'. I use 'hg export .' a
fair amount. 'hg diff' != 'hg export .', because it's about the working
directory changes.
Matt Mackall - April 12, 2013, 10:44 p.m.
On Fri, 2013-04-12 at 00:49 +0200, Pierre-Yves David wrote:
> On 11 avr. 2013, at 22:38, Mads Kiilerich wrote:
> 
> > # HG changeset patch
> > # User Mads Kiilerich <mads@kiilerich.com>
> > # Date 1360539792 -3600
> > #      Mon Feb 11 00:43:12 2013 +0100
> > # Node ID 67c827fdb3f6e42c261d50571acbde34ddde45e2
> > # Parent  027e7edd2707aba417c22fc9bf813d73ef54f6ea
> > export: export working directory parent by default
> > 
> > A common usecase for export is to preview the patch that will be patchbombed or
> > to see what changed in a revision found by bisect. Showing the working
> > directory parent is thus a useful and obvious default.
> 
> Sounds like a decent default behavior. But you have to update the help too.

And the command line summary needs to indicate REV is optional.
Augie Fackler - April 13, 2013, 12:41 a.m.
On Apr 12, 2013, at 6:44 PM, Matt Mackall <mpm@selenic.com> wrote:

> On Fri, 2013-04-12 at 16:34 -0400, Augie Fackler wrote:
>> On Fri, Apr 12, 2013 at 12:49:43AM +0200, Pierre-Yves David wrote:
>>> 
>>> On 11 avr. 2013, at 22:38, Mads Kiilerich wrote:
>>> 
>>>> # HG changeset patch
>>>> # User Mads Kiilerich <mads@kiilerich.com>
>>>> # Date 1360539792 -3600
>>>> #      Mon Feb 11 00:43:12 2013 +0100
>>>> # Node ID 67c827fdb3f6e42c261d50571acbde34ddde45e2
>>>> # Parent  027e7edd2707aba417c22fc9bf813d73ef54f6ea
>>>> export: export working directory parent by default
>>>> 
>>>> A common usecase for export is to preview the patch that will be patchbombed or
>>>> to see what changed in a revision found by bisect. Showing the working
>>>> directory parent is thus a useful and obvious default.
>>> 
>>> Sounds like a decent default behavior. But you have to update the help too.
>> 
>> I'm not so sure. Why is this good in a way that 'hg diff' isn't for
>> uncommitted work?
> 
> The proposal here is 'hg export' == 'hg export .'. I use 'hg export .' a
> fair amount. 'hg diff' != 'hg export .', because it's about the working
> directory changes.

Ah, brain fart. Sounds reasonable enough.

> 
> -- 
> Mathematics is the supreme nostalgia of our time.
> 
>

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2771,6 +2771,8 @@ 
     Returns 0 on success.
     """
     changesets += tuple(opts.get('rev', []))
+    if not changesets:
+        changesets = ['.']
     revs = scmutil.revrange(repo, changesets)
     if not revs:
         raise util.Abort(_("export requires at least one changeset"))
diff --git a/tests/test-export.t b/tests/test-export.t
--- a/tests/test-export.t
+++ b/tests/test-export.t
@@ -148,8 +148,23 @@ 
 Catch exporting unknown revisions (especially empty revsets, see issue3353)
 
   $ hg export
-  abort: export requires at least one changeset
-  [255]
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 197ecd81a57f760b54f34a58817ad5b04991fa47
+  # Parent  f3acbafac161ec68f1598af38f794f28847ca5d3
+   !"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+  
+  diff -r f3acbafac161 -r 197ecd81a57f foo
+  --- a/foo	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
+  @@ -10,3 +10,4 @@
+   foo-9
+   foo-10
+   foo-11
+  +line
+
   $ hg export ""
   hg: parse error: empty query
   [255]