Patchwork wireproto: clarify cryptic 'unsynced changes' error message

login
register
mail settings
Submitter Mads Kiilerich
Date April 11, 2013, 8:35 p.m.
Message ID <e34e55c1738d828cd840.1365712554@mk-desktop>
Download mbox | patch
Permalink /patch/1280/
State Superseded
Headers show

Comments

Mads Kiilerich - April 11, 2013, 8:35 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1365684858 -7200
#      Thu Apr 11 14:54:18 2013 +0200
# Node ID e34e55c1738d828cd8406b234beae3ab8469ec16
# Parent  33c8339a9bcc40714df865a5bdc4cf9b1e669c48
wireproto: clarify cryptic 'unsynced changes' error message

The message was not very much to the point and did not in any way help an
ordinary user.

'repository changed while preparing/uploading bundle - please try again'
is more correct, gives the user some understanding of what is going on, and
tells how to 'recover' from the situation.

The 'bundle' aspect could be seen as an implementation detail that shouldn't be
mentioned, but I think it helps giving an exact error message.

The message could still leave the user wondering why Mercurial doesn't lock the
repo and how unsafe it thus is. Explaining that is however too much detail.
Pierre-Yves David - April 11, 2013, 10:59 p.m.
On 11 avr. 2013, at 22:35, Mads Kiilerich wrote:

> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1365684858 -7200
> #      Thu Apr 11 14:54:18 2013 +0200
> # Node ID e34e55c1738d828cd8406b234beae3ab8469ec16
> # Parent  33c8339a9bcc40714df865a5bdc4cf9b1e669c48
> wireproto: clarify cryptic 'unsynced changes' error message
> 
> The message was not very much to the point and did not in any way help an
> ordinary user.
> 
> 'repository changed while preparing/uploading bundle - please try again'
> is more correct, gives the user some understanding of what is going on, and
> tells how to 'recover' from the situation.
> 
> The 'bundle' aspect could be seen as an implementation detail that shouldn't be
> mentioned, but I think it helps giving an exact error message.

Meh, bundle is very cryptic. Maybe changeset's bundle.

"repository changed while uploading changesets bundle - please try again" ?

(but see below anyway)

> The message could still leave the user wondering why Mercurial doesn't lock the
> repo and how unsafe it thus is. Explaining that is however too much detail.

The current message does not make it clear that the *remote* repository is the one who changed. What about:

	new changes on remote repository while uploading data - please try again
Mads Kiilerich - April 11, 2013, 11:42 p.m.
On 04/12/2013 12:59 AM, Pierre-Yves David wrote:
> On 11 avr. 2013, at 22:35, Mads Kiilerich wrote:
>
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1365684858 -7200
>> #      Thu Apr 11 14:54:18 2013 +0200
>> # Node ID e34e55c1738d828cd8406b234beae3ab8469ec16
>> # Parent  33c8339a9bcc40714df865a5bdc4cf9b1e669c48
>> wireproto: clarify cryptic 'unsynced changes' error message
>>
>> The message was not very much to the point and did not in any way help an
>> ordinary user.
>>
>> 'repository changed while preparing/uploading bundle - please try again'
>> is more correct, gives the user some understanding of what is going on, and
>> tells how to 'recover' from the situation.
>>
>> The 'bundle' aspect could be seen as an implementation detail that shouldn't be
>> mentioned, but I think it helps giving an exact error message.
> Meh, bundle is very cryptic.

'bundle' is a core command, and the bundle format is the official (and 
only) format for (almost) lossless transport of changesets.

But we could be less specific and just say packaging / uploading changes.

> Maybe changeset's bundle.
>
> "repository changed while uploading changesets bundle - please try again" ?
>
> (but see below anyway)
>
>> The message could still leave the user wondering why Mercurial doesn't lock the
>> repo and how unsafe it thus is. Explaining that is however too much detail.
> The current message does not make it clear that the *remote* repository is the one who changed. What about:
>
> 	new changes on remote repository while uploading data - please try again

The message is generated on a server. It could try to predict the 
context, but messages that try to do that often ends up being very 
verbose and misleading.

More important: Mercurial as client of this remote system will show the 
message with a 'remote:' prefix.

/Mads

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -602,7 +602,8 @@ 
 
     # fail early if possible
     if not check_heads():
-        return pusherr('unsynced changes')
+        return pusherr('repository changed while preparing bundle - '
+                       'please try again')
 
     # write bundle data to temporary file because it can be big
     fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
@@ -615,7 +616,8 @@ 
             if not check_heads():
                 # someone else committed/pushed/unbundled while we
                 # were transferring data
-                return pusherr('unsynced changes')
+                return pusherr('repository changed while uploading bundle - '
+                               'please try again')
 
             # push can proceed
             fp.seek(0)
diff --git a/tests/test-push-cgi.t b/tests/test-push-cgi.t
--- a/tests/test-push-cgi.t
+++ b/tests/test-push-cgi.t
@@ -35,17 +35,17 @@ 
   1 changesets found
   $ CONTENT_LENGTH=279; export CONTENT_LENGTH;
 
-expect unsynced changes
+expect failure because heads doesn't match (formerly known as 'unsynced changes')
 
   $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING
   $ python hgweb.cgi <bundle.hg >page1 2>&1
   $ cat page1
   Status: 200 Script output follows\r (esc)
   Content-Type: application/mercurial-0.1\r (esc)
-  Content-Length: 19\r (esc)
+  Content-Length: 63\r (esc)
   \r (esc)
   0
-  unsynced changes
+  repository changed while preparing bundle - please try again
 
 successful force push