summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sortri.ml4
-rw-r--r--src/sortri.mli6
-rw-r--r--src/uigtk2.ml2
-rw-r--r--src/uimac14/uimacnew.xcodeproj/project.pbxproj2
-rw-r--r--src/uitext.ml103
5 files changed, 77 insertions, 40 deletions
diff --git a/src/sortri.ml b/src/sortri.ml
index 0a66030..0b965af 100644
--- a/src/sortri.ml
+++ b/src/sortri.ml
@@ -32,8 +32,8 @@ let bysize =
^ "smaller files from being transferred quickly.\n\n"
^ "This preference (as well as the other sorting flags, but not the "
^ "sorting preferences that require patterns as arguments) can be "
- ^ "set interactively and temporarily using the 'Sort' menu in the "
- ^ "graphical user interface.")
+ ^ "set interactively and temporarily using the 'Sort' menu in the "
+ ^ "graphical and text user interfaces.")
let newfirst =
Prefs.createBool "sortnewfirst" false
diff --git a/src/sortri.mli b/src/sortri.mli
index 7f2a84b..511497d 100644
--- a/src/sortri.mli
+++ b/src/sortri.mli
@@ -1,9 +1,9 @@
(* Unison file synchronizer: src/sortri.mli *)
(* Copyright 1999-2018, Benjamin C. Pierce (see COPYING for details) *)
-(* Sort a list of recon items according to the current setting of
- various preferences (defined in sort.ml, and accessible from the
- profile and via the functions below) *)
+(* Sort a list (with a stable sort algorithm) of recon items according to the
+ current setting of various preferences (accessible from the profile and via
+ the functions below) *)
val sortReconItems : Common.reconItem list -> Common.reconItem list
(* The underlying comparison function for sortReconItems (in case we
diff --git a/src/uigtk2.ml b/src/uigtk2.ml
index fbc5d8f..2ba6d79 100644
--- a/src/uigtk2.ml
+++ b/src/uigtk2.ml
@@ -3480,7 +3480,7 @@ lst_store#set ~row ~column:c_path path;
~callback:(fun () -> getLock (fun () ->
Sortri.sortNewFirst();
sortAndRedisplay()))
- "Sort Ne_w Entries First");
+ "Sort Ne_w Entries First (toggle)");
grAdd grRescan
(sortMenu#add_item
~callback:(fun () -> getLock (fun () ->
diff --git a/src/uimac14/uimacnew.xcodeproj/project.pbxproj b/src/uimac14/uimacnew.xcodeproj/project.pbxproj
index a45139e..d6504c3 100644
--- a/src/uimac14/uimacnew.xcodeproj/project.pbxproj
+++ b/src/uimac14/uimacnew.xcodeproj/project.pbxproj
@@ -516,7 +516,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "echo \"Building unison-blob.o...\"\nif [ -x /usr/libexec/path_helper ]; then\n eval `/usr/libexec/path_helper -s`\nfi\ncd ${PROJECT_DIR}/..\nmake unison-blob.o\necho \"done\"";
+ shellScript = "echo \"Building unison-blob.o...\"\nif [ -x /usr/libexec/path_helper ]; then\n eval `/usr/libexec/path_helper -s`\nfi\nif [ -x `which opam` ]; then\neval `opam config env`\nfi\ncd ${PROJECT_DIR}/..\nmake unison-blob.o\necho \"done\"";
};
/* End PBXShellScriptBuildPhase section */
diff --git a/src/uitext.ml b/src/uitext.ml
index 7572716..fdd2568 100644
--- a/src/uitext.ml
+++ b/src/uitext.ml
@@ -188,7 +188,7 @@ let rec selectAction batch actions tryagain =
with
(* Restart an interrupted system call (which can happen notably when
* the process is put in the background by SIGTSTP). *)
- Unix.Unix_error (Unix.EINTR, _, _) -> selectAction batch actions tryagain
+ Unix.Unix_error (Unix.EINTR, _, _) -> tryagainOrLoop()
(* Simply print a slightly more informative message than the exception
* itself (e.g. "Uncaught unix error: read failed: Resource temporarily
* unavailable" or "Uncaught exception End_of_file"). *)
@@ -240,10 +240,11 @@ let displayri ri =
type proceed = ConfirmBeforeProceeding | ProceedImmediately
-let interact rilist =
+(* "interact [] rilist" interactively reconciles each list item *)
+let interact prilist rilist =
+ if not (Prefs.read Globals.batch) then display ("\n" ^ Uicommon.roots2string() ^ "\n");
let (r1,r2) = Globals.roots() in
let (host1, host2) = root2hostname r1, root2hostname r2 in
- if not (Prefs.read Globals.batch) then display ("\n" ^ Uicommon.roots2string() ^ "\n");
let rec loop prev =
let rec previous prev ril =
match prev with
@@ -251,7 +252,7 @@ let interact rilist =
displayri pri; display "\n"; display s; display "\n";
previous pril (pri::ril)
| pri::pril -> loop pril (pri::ril)
- | [] -> loop prev ril in
+ | [] -> display ("\n" ^ Uicommon.roots2string() ^ "\n"); loop prev ril in
function
[] -> (ConfirmBeforeProceeding, Safelist.rev prev)
| ri::rest as ril ->
@@ -275,7 +276,7 @@ let interact rilist =
displayri ri;
match ri.replicas with
Problem s -> display "\n"; display s; display "\n"; next()
- | Different ({rc1 = rc1; rc2 = rc2; direction = dir} as diff) ->
+ | Different ({rc1 = _; rc2 = _; direction = dir} as diff) ->
if Prefs.read Uicommon.auto && not (isConflict dir) then begin
display "\n"; next()
end else
@@ -370,6 +371,11 @@ let interact rilist =
(fun () ->
newLine();
previous prev ril));
+ (["s";"n"],
+ ("stop the selection"),
+ (fun() ->
+ newLine();
+ (ConfirmBeforeProceeding, Safelist.rev_append prev ril)));
(["g"],
("proceed immediately to propagating changes"),
(fun() ->
@@ -397,8 +403,7 @@ let interact rilist =
next()))
]
(fun () -> displayri ri)
- in
- loop [] rilist
+ in loop prilist rilist
let verifyMerge title text =
Printf.printf "%s\n" text;
@@ -559,10 +564,10 @@ let formatStatus major minor =
lastMajor := major;
s
-let rec interactAndPropagateChanges reconItemList
+let rec interactAndPropagateChanges prevItemList reconItemList
: bool * bool * bool * (Path.t list)
(* anySkipped?, anyPartial?, anyFailures?, failingPaths *) =
- let (proceed,newReconItemList) = interact reconItemList in
+ let (proceed,newReconItemList) = interact prevItemList reconItemList in
let (updatesToDo, skipped) =
Safelist.fold_left
(fun (howmany, skipped) ri ->
@@ -649,29 +654,61 @@ let rec interactAndPropagateChanges reconItemList
(skipped > 0, false, false, [])
end else if proceed=ProceedImmediately then begin
doit()
- end else begin
- displayWhenInteractive "\nProceed with propagating updates? ";
- selectAction
- (* BCP: I find it counterintuitive that every other prompt except this one
- would expect <CR> as a default. But I got talked out of offering a
- default here, because of safety considerations (too easy to press
- <CR> one time too many). *)
- (if Prefs.read Globals.batch then Some "y" else None)
- [(["y";"g"],
- "Yes: proceed with updates as selected above",
- doit);
- (["n"],
- "No: go through selections again",
- (fun () ->
- Prefs.set Uicommon.auto false;
- newLine();
- interactAndPropagateChanges reconItemList));
- (["q"],
- ("exit " ^ Uutil.myName ^ " without propagating any changes"),
- fun () -> raise Sys.Break)
- ]
- (fun () -> display "Proceed with propagating updates? ")
- end
+ end else
+ let rec askagain newReconItemList =
+ displayWhenInteractive "\nProceed with propagating updates? ";
+ selectAction
+ (* BCP: I find it counterintuitive that every other prompt except this one
+ would expect <CR> as a default. But I got talked out of offering a
+ default here, because of safety considerations (too easy to press
+ <CR> one time too many). *)
+ (if Prefs.read Globals.batch then Some "y" else None)
+ [(["y";"g"],
+ "Yes: proceed with updates as selected above",
+ doit);
+ (["n"],
+ "No: go through selections again",
+ (fun () ->
+ Prefs.set Uicommon.auto false;
+ newLine();
+ interactAndPropagateChanges [] newReconItemList));
+ (["p";"b"],
+ "go back to the last item of the selection",
+ (fun () ->
+ Prefs.set Uicommon.auto false;
+ newLine();
+ match Safelist.rev newReconItemList with
+ [] -> interactAndPropagateChanges [] []
+ | lastri::prev -> interactAndPropagateChanges prev [lastri]));
+ (["N"],
+ "sort by Name",
+ (fun () ->
+ Sortri.sortByName();
+ askagain (Sortri.sortReconItems newReconItemList)));
+ (["S"],
+ "sort by Size",
+ (fun () ->
+ Sortri.sortBySize();
+ askagain (Sortri.sortReconItems newReconItemList)));
+ (["W"],
+ "sort neW first (toggle)",
+ (fun () ->
+ Sortri.sortNewFirst();
+ askagain (Sortri.sortReconItems newReconItemList)));
+ (["D"],
+ "Default ordering",
+ (fun () ->
+ Sortri.restoreDefaultSettings();
+ askagain (Sortri.sortReconItems newReconItemList)));
+ (["R"],
+ "Reverse the sort order",
+ (fun () -> askagain (Safelist.rev newReconItemList)));
+ (["q"],
+ ("exit " ^ Uutil.myName ^ " without propagating any changes"),
+ fun () -> raise Sys.Break)
+ ]
+ (fun () -> display "Proceed with propagating updates? ")
+ in askagain newReconItemList
let checkForDangerousPath dangerousPaths =
if Prefs.read Globals.confirmBigDeletes then begin
@@ -735,7 +772,7 @@ let synchronizeOnce ?wantWatcher ?skipRecentFiles pathsOpt =
end else begin
checkForDangerousPath dangerousPaths;
let (anySkipped, anyPartial, anyFailures, failedPaths) =
- interactAndPropagateChanges reconItemList in
+ interactAndPropagateChanges [] reconItemList in
let exitStatus = Uicommon.exitCode(anySkipped || anyPartial,anyFailures) in
(exitStatus, failedPaths)
end