[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: RFC: change 'svn merge' default behavior.

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2004-01-16 22:18:45 CET

Whew, let me try to summarize this thread so far.

The status quo is currently 'merge ignores ancestry', 'diff ignores
ancestry'.

As I said in an earlier mail, the main thing we all agree on is that
merge should be flipped to 'notices ancestry'. The consequences of
not doing so are very bad (see my previous mail about being burned).
The problem is, if you pull merge in that direction, then diff no
longer acts as an automatic 'dry run' for merge.

This has resulted in people arguing about whether or not 'diff' should
flip direction as well:

   * sander and brane think diff should have *two* default behaviors
     based on syntax. 'diff -rX:Y URL' should be 'notices ancestry'
     and 'diff URL1 URL2' should be 'ignores ancestry'.

   * ghudson and epg think there's never any point in diff noticing
     ancestry, because the format is so primitive. (i.e. what's the
     point of pushing history information through a format that can't
     handle it well?) It usually blocks the information users really
     want to see.

     ... and brane responds that history information is still
     information, and shouldn't be tossed. 'svn diff' is unique to
     subversion, different than GNU diff, just like 'svn mv/cp/rm' is
     different from unix counterpoints in subtle ways.

In some sense, I feel like the thread has become derailed. Apparently
we never really had consensus about the 'diff ignores ancestry' change
way back when. But I also point out: it's really not necessary to
resolve the issue of diff's behavior right now. Diff doing the
"wrong" thing is low-impact: the user just runs diff again with an
option. It doesn't carry any real danger, at least not like a merge
gone wrong.

The 'dry run' problem can easily be put on the back-burner as well,
meaning that if we simply did

    merge notices ancestry, diff ignores ancestry

...then we can doc around the dry-run issue. ("For detailed dry runs,
run 'diff --notice-ancestry'").

Karl and I feel that it's just not important to choose a permanent
diff behavior now. Ignoring merge's current behavior actually has the
risk of burning real 1.0 users, but diff's current behavior doesn't
risk anything but some confusion (and even that is still being debated
by two sides.)

Maybe someday 'svn diff' will produce a "next generation"
tree-aware patch format... maybe that will be a different
subcommand... nobody knows. Whatever the case, if we need to change
diff's behavior in the future, we're not going to see angry mobs of
users at our door. People are not going to depend in a scripty way on
diff ignoring ancestry; if diff behavior changes later, it's more like a
bugfix than a significant UI change.

That said, here's a simple patch that does 'merge ignores ancestry'
==> 'merge notices ancestry'. It only changes the internals of the
cmdline client.

Make 'svn merge' notice ancestry by default. Create new
--ignore-ancestry option as a way to override this behavior.

* clients/cmdline/cl.h
  (svn_cl__ignore_ancestry_opt): new enum.
  (svn_cl__opt_state_t): new ignore_ancestry boolean.

* clients/cmdline/main.c
  (svn_cl__options): describe ignore_ancestry option.
  (svn_cl__cmd_table): make 'merge' accept --ignore-ancestry option.
  (main): parse --ignore-ancestry into opt_state.

* clients/cmdline/merge-cmd.c
  (svn_cl__merge): pass ignore_ancestry option directly into svn_client_merge.

Index: subversion/clients/cmdline/merge-cmd.c
===================================================================
--- subversion/clients/cmdline/merge-cmd.c (revision 8324)
+++ subversion/clients/cmdline/merge-cmd.c (working copy)
@@ -162,7 +162,7 @@
                           &(opt_state->end_revision),
                           targetpath,
                           opt_state->nonrecursive ? FALSE : TRUE,
- opt_state->notice_ancestry ? FALSE : TRUE,
+ opt_state->ignore_ancestry,
                           opt_state->force,
                           opt_state->dry_run,
                           ctx,
Index: subversion/clients/cmdline/cl.h
===================================================================
--- subversion/clients/cmdline/cl.h (revision 8324)
+++ subversion/clients/cmdline/cl.h (working copy)
@@ -55,6 +55,7 @@
   svn_cl__encoding_opt,
   svn_cl__force_log_opt,
   svn_cl__force_opt,
+ svn_cl__ignore_ancestry_opt,
   svn_cl__incremental_opt,
   svn_cl__merge_cmd_opt,
   svn_cl__new_cmd_opt,
@@ -115,6 +116,7 @@
   svn_boolean_t no_auth_cache; /* do not cache authentication information */
   svn_boolean_t no_diff_deleted; /* do not show diffs for deleted files */
   svn_boolean_t notice_ancestry; /* notice ancestry for diff-y operations */
+ svn_boolean_t ignore_ancestry; /* ignore ancestry for merge-y operations */
   svn_boolean_t stop_on_copy; /* don't cross copies during processing */
   svn_boolean_t dry_run; /* try operation but make no changes */
   svn_boolean_t revprop; /* operate on a revision property */
Index: subversion/clients/cmdline/main.c
===================================================================
--- subversion/clients/cmdline/main.c (revision 8324)
+++ subversion/clients/cmdline/main.c (working copy)
@@ -107,6 +107,8 @@
                        "do not print differences for deleted files"},
     {"notice-ancestry", svn_cl__notice_ancestry_opt, 0,
                        "notice ancestry when calculating differences"},
+ {"ignore-ancestry", svn_cl__ignore_ancestry_opt, 0,
+ "ignore ancestry when calculating merges"},
     {"diff-cmd", svn_cl__diff_cmd_opt, 1,
                       "use ARG as diff command"},
     {"diff3-cmd", svn_cl__merge_cmd_opt, 1,
@@ -367,7 +369,7 @@
     " the sources have identical basenames that match a file within '.':\n"
     " in which case, the differences will be applied to that file.\n",
     {'r', 'N', 'q', svn_cl__force_opt, svn_cl__dry_run_opt,
- svn_cl__merge_cmd_opt, svn_cl__notice_ancestry_opt,
+ svn_cl__merge_cmd_opt, svn_cl__ignore_ancestry_opt,
      SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} },
    
   { "mkdir", svn_cl__mkdir, {0},
@@ -888,6 +890,9 @@
       case svn_cl__notice_ancestry_opt:
         opt_state.notice_ancestry = TRUE;
         break;
+ case svn_cl__ignore_ancestry_opt:
+ opt_state.ignore_ancestry = TRUE;
+ break;
       case svn_cl__relocate_opt:
         opt_state.relocate = TRUE;
         break;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jan 16 22:19:20 2004

This is an archived mail posted to the Subversion Dev mailing list.