# Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: martin.vgagern@gmx.net-20090504154753-1ht6w3g5cbwpm9yu # target_branch: http://bazaar.launchpad.net/~unison/unison/trunk # testament_sha1: 729c80164fd2e5e562afa3b4c4b40fd4e5a22cbe # timestamp: 2009-05-04 18:04:34 +0200 # source_branch: http://bazaar.launchpad.net/~unison/unison/bzrbuild # base_revision_id: svn-v4:4bce34ff-96ee-0310-b826-\ # 95abcfff6e26:trunk:321 # # Begin patch === added file '.bzrignore' --- .bzrignore 1970-01-01 00:00:00 +0000 +++ .bzrignore 2009-05-04 15:47:53 +0000 @@ -0,0 +1,9 @@ +src/Makefile.ProjectInfo +src/mkProjectInfo +src/TAGS +src/ubase/projectInfo.ml +src/unison +src/unison.exe +src/**/*.cmi +src/**/*.cmx +src/**/*.cmo === modified file 'src/Makefile' --- src/Makefile 2008-08-21 14:39:05 +0000 +++ src/Makefile 2009-05-04 15:47:53 +0000 @@ -37,6 +37,16 @@ all:: INSTALL +.PHONY: all clean install doinstall installtext text \ + setupdemo-old setupdemo modifydemo demo \ + run runbatch runt rundebug runp runtext runsort runprefer \ + prefsdocs runtest repeattest \ + selftest selftestdebug selftestremote testmerge \ + checkin installremote + +.DELETE_ON_ERROR: +# to avoid problems when e.g. mkProjectInfo fails to run + INSTALL: $(NAME)$(EXEC_EXT) # file isn't made for OS X, so check that it's there first (if [ -f $(NAME) ]; then ./$(NAME) -doc install > INSTALLATION; fi) @@ -50,11 +60,14 @@ # NAME, VERSION, and MAJORVERSION, automatically generated -include Makefile.ProjectInfo -Makefile.ProjectInfo: mkProjectInfo +../.bzr/branch/last-revision: +# Do nothing to create this target if it doesn't already exist. + +Makefile.ProjectInfo: mkProjectInfo ../.bzr/branch/last-revision ./mkProjectInfo > $@ mkProjectInfo: mkProjectInfo.ml - ocamlc -o $@ $^ + ocamlc -o $@ unix.cma str.cma $^ clean:: $(RM) mkProjectInfo === modified file 'src/Makefile.OCaml' --- src/Makefile.OCaml 2009-05-02 00:57:23 +0000 +++ src/Makefile.OCaml 2009-05-04 15:47:53 +0000 @@ -125,6 +125,7 @@ endif endif +.PHONY: buildexecutable buildexecutable:: @echo NATIVE = $(NATIVE) @echo THREADS = $(THREADS) @@ -132,7 +133,7 @@ @echo OSTYPE = $(OSTYPE) @echo OSARCH = $(OSARCH) -ubase/projectInfo.ml: mkProjectInfo +ubase/projectInfo.ml: Makefile.ProjectInfo echo 'let myName = "'$(NAME)'";;' > $@ echo 'let myVersion = "'$(VERSION)'";;' >> $@ echo 'let myMajorVersion = "'$(MAJORVERSION)'";;' >> $@ @@ -160,6 +161,7 @@ # NOTE: the OCAMLLIBDIR is not getting passed correctly? # The two cases for cltool are needed because Xcode 2.1+ # builds in build/Default/, and earlier versions use build/ +.PHONY: macexecutable macexecutable: $(NAME)-blob.o # sed -e's/@@VERSION@@/$(VERSION)/' $(UIMACDIR)/Info.plist.template > $(UIMACDIR)/Info.plist (cd $(UIMACDIR); xcodebuild OCAMLLIBDIR="$(OCAMLLIBDIR)" SYMROOT=build) @@ -388,6 +390,7 @@ -$(RM) -r *.obj *.lib *.exp -$(RM) -r *.tmp *.bak?.tmp .*.bak?.tmp +.PHONY: paths paths: @echo PATH = $(PATH) @echo OCAMLLIBDIR = $(OCAMLLIBDIR) === modified file 'src/mkProjectInfo.ml' --- src/mkProjectInfo.ml 2009-05-02 01:30:31 +0000 +++ src/mkProjectInfo.ml 2009-05-04 13:14:57 +0000 @@ -42,9 +42,36 @@ (* ---------------------------------------------------------------------- *) (* You shouldn't need to edit below. *) +(* run the bzr tool to get version information for bzr branches *) +exception BzrException of Unix.process_status;; +let bzr args = + let bzr = (try Sys.getenv "BZR" with Not_found -> "bzr") in + let cmd = bzr ^ " " ^ args in + let inc = Unix.open_process_in cmd in + let buf = Buffer.create 16 in + (try + while true do + Buffer.add_channel buf inc 1 + done + with End_of_file -> ()); + let status = Unix.close_process_in inc in + match status with + Unix.WEXITED 0 -> Buffer.contents buf + | _ -> raise (BzrException status);; + +(* extract a substring using a regular expression *) +let extract_str re str = + let _ = Str.search_forward (Str.regexp re) str 0 in + Str.matched_group 1 str;; +let extract_int re str = int_of_string (extract_str re str);; + let revisionString = "$Rev$";; -let revision = Scanf.sscanf revisionString "$Rev: %d " (fun x -> x);; -let pointVersion = revision - pointVersionOrigin;; +let pointVersion = if String.length revisionString > 5 +then Scanf.sscanf revisionString "$Rev: %d " (fun x -> x) - pointVersionOrigin +else let pvo = extract_int "^revno:[ \t]*\\([0-9]+\\)[ \t]*$" + (bzr ("log -r svn:" ^ + string_of_int pointVersionOrigin)) in + extract_int "^\\([0-9]+\\)$" (bzr "revno") - pvo;; Printf.printf "MAJORVERSION=%d.%d\n" majorVersion minorVersion;; Printf.printf "VERSION=%d.%d.%d\n" majorVersion minorVersion pointVersion;;