\hypertarget{kdbmerge_8h}{}\doxysection{kdbmerge.\+h File Reference}
\label{kdbmerge_8h}\index{kdbmerge.h@{kdbmerge.h}}


Kdb merge tool.  


{\ttfamily \#include \char`\"{}kdb.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}kdbtypes.\+h\char`\"{}}\newline
Include dependency graph for kdbmerge.\+h\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=214pt]{kdbmerge_8h__incl}
\end{center}
\end{figure}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5c}{Merge\+Strategy}} \{ \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5caeaf7be70515ee5bc9b6dae1c844ec492}{MERGE\+\_\+\+STRATEGY\+\_\+\+ABORT}} = 1
, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca59bbe6fb70e4687da28d18f709c730e3}{MERGE\+\_\+\+STRATEGY\+\_\+\+OUR}} = 3
, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca7b266b5546be0e2a741ac201a57e7a9c}{MERGE\+\_\+\+STRATEGY\+\_\+\+THEIR}} = 4
 \}
\begin{DoxyCompactList}\small\item\em The strategy to use when a merge conflict occurs. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
Key\+Set $\ast$ \mbox{\hyperlink{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}{elektra\+Merge}} (Key\+Set $\ast$our, Key $\ast$our\+Root, Key\+Set $\ast$their, Key $\ast$their\+Root, Key\+Set $\ast$base, Key $\ast$base\+Root, Key $\ast$result\+Key, enum \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5c}{Merge\+Strategy}} strategy, Key $\ast$information\+Key)
\begin{DoxyCompactList}\small\item\em This function can incorporate changes from two modified versions (our and their) into a common preceding version (base) of a key set. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{kdbmerge_8h_aa4b4c9a6f50a1f5d602fc84c8abce208}{elektra\+Merge\+Get\+Conflicts}} (Key $\ast$information\+Key)
\begin{DoxyCompactList}\small\item\em This function returns the number of conflicts that is store in the key. \end{DoxyCompactList}\item 
Key\+Set $\ast$ \mbox{\hyperlink{kdbmerge_8h_af77d7bd856529ee1446e63c84c6172bd}{elektra\+Merge\+Get\+Conflicting\+Keys}} (Key $\ast$information\+Key, Key $\ast$root)
\begin{DoxyCompactList}\small\item\em Returns a keyset with all conflicting keys under the specified root. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{kdbmerge_8h_ab17338c46c347a716ce354039310841b}{elektra\+Merge\+Is\+Key\+Conflicting}} (Key $\ast$information\+Key, Key $\ast$root, Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Check whether the given key was part of a conflict. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Kdb merge tool. 

\begin{DoxyCopyright}{Copyright}
BSD License (see LICENSE.\+md or \href{https://ww.libelektra.org}{\texttt{ https\+://ww.\+libelektra.\+org}}) 
\end{DoxyCopyright}


\doxysubsection{Enumeration Type Documentation}
\mbox{\Hypertarget{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5c}\label{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5c}} 
\index{kdbmerge.h@{kdbmerge.h}!MergeStrategy@{MergeStrategy}}
\index{MergeStrategy@{MergeStrategy}!kdbmerge.h@{kdbmerge.h}}
\doxysubsubsection{\texorpdfstring{MergeStrategy}{MergeStrategy}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5c}{Merge\+Strategy}}}



The strategy to use when a merge conflict occurs. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{MERGE\_STRATEGY\_ABORT@{MERGE\_STRATEGY\_ABORT}!kdbmerge.h@{kdbmerge.h}}\index{kdbmerge.h@{kdbmerge.h}!MERGE\_STRATEGY\_ABORT@{MERGE\_STRATEGY\_ABORT}}}\mbox{\Hypertarget{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5caeaf7be70515ee5bc9b6dae1c844ec492}\label{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5caeaf7be70515ee5bc9b6dae1c844ec492}} 
MERGE\+\_\+\+STRATEGY\+\_\+\+ABORT&Abort merging if a conflict occurs \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{MERGE\_STRATEGY\_OUR@{MERGE\_STRATEGY\_OUR}!kdbmerge.h@{kdbmerge.h}}\index{kdbmerge.h@{kdbmerge.h}!MERGE\_STRATEGY\_OUR@{MERGE\_STRATEGY\_OUR}}}\mbox{\Hypertarget{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca59bbe6fb70e4687da28d18f709c730e3}\label{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca59bbe6fb70e4687da28d18f709c730e3}} 
MERGE\+\_\+\+STRATEGY\+\_\+\+OUR&Prefer our keys in case of conflict \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{MERGE\_STRATEGY\_THEIR@{MERGE\_STRATEGY\_THEIR}!kdbmerge.h@{kdbmerge.h}}\index{kdbmerge.h@{kdbmerge.h}!MERGE\_STRATEGY\_THEIR@{MERGE\_STRATEGY\_THEIR}}}\mbox{\Hypertarget{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca7b266b5546be0e2a741ac201a57e7a9c}\label{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca7b266b5546be0e2a741ac201a57e7a9c}} 
MERGE\+\_\+\+STRATEGY\+\_\+\+THEIR&Prefer their keys in case of conflict \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}\label{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}} 
\index{kdbmerge.h@{kdbmerge.h}!elektraMerge@{elektraMerge}}
\index{elektraMerge@{elektraMerge}!kdbmerge.h@{kdbmerge.h}}
\doxysubsubsection{\texorpdfstring{elektraMerge()}{elektraMerge()}}
{\footnotesize\ttfamily Key\+Set$\ast$ elektra\+Merge (\begin{DoxyParamCaption}\item[{Key\+Set $\ast$}]{our,  }\item[{Key $\ast$}]{our\+Root,  }\item[{Key\+Set $\ast$}]{their,  }\item[{Key $\ast$}]{their\+Root,  }\item[{Key\+Set $\ast$}]{base,  }\item[{Key $\ast$}]{base\+Root,  }\item[{Key $\ast$}]{result\+Root,  }\item[{enum \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5c}{Merge\+Strategy}}}]{strategy,  }\item[{Key $\ast$}]{information\+Key }\end{DoxyParamCaption})}



This function can incorporate changes from two modified versions (our and their) into a common preceding version (base) of a key set. 

This lets you merge the sets of changes represented by the two newer key sets. This is called a three-\/way merge between key sets.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <kdb.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{kdbmerge_8h}{kdbmerge.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} print\_results (KeySet * result, Key * resultRoot, Key * informationKey)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        KeySet * conflictingKeys = \mbox{\hyperlink{kdbmerge_8h_af77d7bd856529ee1446e63c84c6172bd}{elektraMergeGetConflictingKeys}} (informationKey, resultRoot);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{for} (elektraCursor i = 0; i < \mbox{\hyperlink{group__keyset_ga7474ad6b0a0fa969dbdf267ba5770eee}{ksGetSize}} (conflictingKeys); i++)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                printf (\textcolor{stringliteral}{"{}Conflict in key \%s\(\backslash\)n"{}}, \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (\mbox{\hyperlink{group__keyset_gab3fb5e067c672d9fd60a4022b2ae9dd1}{ksAtCursor}} (conflictingKeys, i)));}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}Result:\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{for} (elektraCursor i = 0; i < \mbox{\hyperlink{group__keyset_ga7474ad6b0a0fa969dbdf267ba5770eee}{ksGetSize}} (result); i++)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                Key * k = \mbox{\hyperlink{group__keyset_gab3fb5e067c672d9fd60a4022b2ae9dd1}{ksAtCursor}} (result, i);}
\DoxyCodeLine{                printf (\textcolor{stringliteral}{"{}\%s = \%s\(\backslash\)n"{}}, \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (k), \mbox{\hyperlink{group__keyvalue_ga880936f2481d28e6e2acbe7486a21d05}{keyString}} (k));}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (result == NULL)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                printf (\textcolor{stringliteral}{"{}Aborted.\(\backslash\)n"{}});}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (conflictingKeys);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int} \mbox{\hyperlink{testio__doc_8c_a3c04138a5bfe5d72780bb7e82a18e627}{main}} (\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{        Key * baseRoot = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{        KeySet * base = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}} (1, \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/background"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}blue"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}), \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{        Key * theirRoot = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{        KeySet * their = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}} (2, \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/background"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}red"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}),}
\DoxyCodeLine{                                \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/brightness"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}100"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}), \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{        Key * ourRoot = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{        KeySet * our = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}} (2, \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/background"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}purple"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}),}
\DoxyCodeLine{                              \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/standby"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}on"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}), \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{        Key * resultRoot = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{        Key * informationKey = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{// Strategy: Abort}}
\DoxyCodeLine{        \textcolor{comment}{// Will abort due to user:/screen/background changes in both their and our}}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}Trying merge strategy ABORT\(\backslash\)n"{}});}
\DoxyCodeLine{        KeySet * result = \mbox{\hyperlink{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}{elektraMerge}} (our, ourRoot, their, theirRoot, base, baseRoot, resultRoot, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5caeaf7be70515ee5bc9b6dae1c844ec492}{MERGE\_STRATEGY\_ABORT}}, informationKey);}
\DoxyCodeLine{        print\_results (result, resultRoot, informationKey);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (result);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{// Strategy: Our}}
\DoxyCodeLine{        \textcolor{comment}{// Will take value of our for user:/screen/background}}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}\(\backslash\)nTrying merge strategy OUR\(\backslash\)n"{}});}
\DoxyCodeLine{        result = \mbox{\hyperlink{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}{elektraMerge}} (our, ourRoot, their, theirRoot, base, baseRoot, resultRoot, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca59bbe6fb70e4687da28d18f709c730e3}{MERGE\_STRATEGY\_OUR}}, informationKey);}
\DoxyCodeLine{        print\_results (result, resultRoot, informationKey);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (result);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{// Strategy: Their}}
\DoxyCodeLine{        \textcolor{comment}{// Will take value of their for user:/screen/background}}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}\(\backslash\)nTrying merge strategy THEIR\(\backslash\)n"{}});}
\DoxyCodeLine{        result = \mbox{\hyperlink{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}{elektraMerge}} (our, ourRoot, their, theirRoot, base, baseRoot, resultRoot, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca7b266b5546be0e2a741ac201a57e7a9c}{MERGE\_STRATEGY\_THEIR}}, informationKey);}
\DoxyCodeLine{        print\_results (result, resultRoot, informationKey);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (result);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (base);}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (their);}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (our);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (baseRoot);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (theirRoot);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (ourRoot);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (informationKey);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (resultRoot);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


Join three key sets together 
\begin{DoxyParams}{Parameters}
{\em our} & our key set \\
\hline
{\em our\+Root} & key that has the root of our as name \\
\hline
{\em their} & their key set \\
\hline
{\em their\+Root} & key that has the root of their as name \\
\hline
{\em base} & base key set \\
\hline
{\em base\+Root} & key that has the root of base as name \\
\hline
{\em result\+Root} & the name of this key determines where the resulting key set will be stored \\
\hline
{\em strategy} & specify which merge strategy to choose in case of a conflict \\
\hline
{\em information\+Key} & stores errors as well as statistics \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the merged key set and NULL on error 
\end{DoxyReturn}
\mbox{\Hypertarget{kdbmerge_8h_af77d7bd856529ee1446e63c84c6172bd}\label{kdbmerge_8h_af77d7bd856529ee1446e63c84c6172bd}} 
\index{kdbmerge.h@{kdbmerge.h}!elektraMergeGetConflictingKeys@{elektraMergeGetConflictingKeys}}
\index{elektraMergeGetConflictingKeys@{elektraMergeGetConflictingKeys}!kdbmerge.h@{kdbmerge.h}}
\doxysubsubsection{\texorpdfstring{elektraMergeGetConflictingKeys()}{elektraMergeGetConflictingKeys()}}
{\footnotesize\ttfamily Key\+Set$\ast$ elektra\+Merge\+Get\+Conflicting\+Keys (\begin{DoxyParamCaption}\item[{Key $\ast$}]{information\+Key,  }\item[{Key $\ast$}]{root }\end{DoxyParamCaption})}



Returns a keyset with all conflicting keys under the specified root. 


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <kdb.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{kdbmerge_8h}{kdbmerge.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} print\_results (KeySet * result, Key * resultRoot, Key * informationKey)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        KeySet * conflictingKeys = \mbox{\hyperlink{kdbmerge_8h_af77d7bd856529ee1446e63c84c6172bd}{elektraMergeGetConflictingKeys}} (informationKey, resultRoot);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{for} (elektraCursor i = 0; i < \mbox{\hyperlink{group__keyset_ga7474ad6b0a0fa969dbdf267ba5770eee}{ksGetSize}} (conflictingKeys); i++)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                printf (\textcolor{stringliteral}{"{}Conflict in key \%s\(\backslash\)n"{}}, \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (\mbox{\hyperlink{group__keyset_gab3fb5e067c672d9fd60a4022b2ae9dd1}{ksAtCursor}} (conflictingKeys, i)));}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}Result:\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{for} (elektraCursor i = 0; i < \mbox{\hyperlink{group__keyset_ga7474ad6b0a0fa969dbdf267ba5770eee}{ksGetSize}} (result); i++)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                Key * k = \mbox{\hyperlink{group__keyset_gab3fb5e067c672d9fd60a4022b2ae9dd1}{ksAtCursor}} (result, i);}
\DoxyCodeLine{                printf (\textcolor{stringliteral}{"{}\%s = \%s\(\backslash\)n"{}}, \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (k), \mbox{\hyperlink{group__keyvalue_ga880936f2481d28e6e2acbe7486a21d05}{keyString}} (k));}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (result == NULL)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                printf (\textcolor{stringliteral}{"{}Aborted.\(\backslash\)n"{}});}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (conflictingKeys);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int} \mbox{\hyperlink{testio__doc_8c_a3c04138a5bfe5d72780bb7e82a18e627}{main}} (\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{        Key * baseRoot = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{        KeySet * base = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}} (1, \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/background"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}blue"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}), \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{        Key * theirRoot = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{        KeySet * their = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}} (2, \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/background"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}red"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}),}
\DoxyCodeLine{                                \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/brightness"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}100"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}), \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{        Key * ourRoot = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{        KeySet * our = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}} (2, \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/background"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}purple"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}),}
\DoxyCodeLine{                              \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/screen/standby"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}on"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}), \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{        Key * resultRoot = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{        Key * informationKey = keyDup (baseRoot, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{// Strategy: Abort}}
\DoxyCodeLine{        \textcolor{comment}{// Will abort due to user:/screen/background changes in both their and our}}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}Trying merge strategy ABORT\(\backslash\)n"{}});}
\DoxyCodeLine{        KeySet * result = \mbox{\hyperlink{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}{elektraMerge}} (our, ourRoot, their, theirRoot, base, baseRoot, resultRoot, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5caeaf7be70515ee5bc9b6dae1c844ec492}{MERGE\_STRATEGY\_ABORT}}, informationKey);}
\DoxyCodeLine{        print\_results (result, resultRoot, informationKey);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (result);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{// Strategy: Our}}
\DoxyCodeLine{        \textcolor{comment}{// Will take value of our for user:/screen/background}}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}\(\backslash\)nTrying merge strategy OUR\(\backslash\)n"{}});}
\DoxyCodeLine{        result = \mbox{\hyperlink{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}{elektraMerge}} (our, ourRoot, their, theirRoot, base, baseRoot, resultRoot, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca59bbe6fb70e4687da28d18f709c730e3}{MERGE\_STRATEGY\_OUR}}, informationKey);}
\DoxyCodeLine{        print\_results (result, resultRoot, informationKey);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (result);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{// Strategy: Their}}
\DoxyCodeLine{        \textcolor{comment}{// Will take value of their for user:/screen/background}}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}\(\backslash\)nTrying merge strategy THEIR\(\backslash\)n"{}});}
\DoxyCodeLine{        result = \mbox{\hyperlink{kdbmerge_8h_a2cc0dc19c99b2bc86feb1f2607df343a}{elektraMerge}} (our, ourRoot, their, theirRoot, base, baseRoot, resultRoot, \mbox{\hyperlink{kdbmerge_8h_a2c76c3f8b54a741ba9fdbfe6b5e0ee5ca7b266b5546be0e2a741ac201a57e7a9c}{MERGE\_STRATEGY\_THEIR}}, informationKey);}
\DoxyCodeLine{        print\_results (result, resultRoot, informationKey);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (result);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (base);}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (their);}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (our);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (baseRoot);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (theirRoot);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (ourRoot);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (informationKey);}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (resultRoot);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}



\begin{DoxyParams}{Parameters}
{\em information\+Key} & stores errors as well as statistics \\
\hline
{\em root} & The root key (either for base, theirs, ours or result) that was used in the merge \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Key\+Set containing all keys that are part of a merge conflict. Will be empty if the specified root key was not part of the merge. 
\end{DoxyReturn}
\mbox{\Hypertarget{kdbmerge_8h_aa4b4c9a6f50a1f5d602fc84c8abce208}\label{kdbmerge_8h_aa4b4c9a6f50a1f5d602fc84c8abce208}} 
\index{kdbmerge.h@{kdbmerge.h}!elektraMergeGetConflicts@{elektraMergeGetConflicts}}
\index{elektraMergeGetConflicts@{elektraMergeGetConflicts}!kdbmerge.h@{kdbmerge.h}}
\doxysubsubsection{\texorpdfstring{elektraMergeGetConflicts()}{elektraMergeGetConflicts()}}
{\footnotesize\ttfamily int elektra\+Merge\+Get\+Conflicts (\begin{DoxyParamCaption}\item[{Key $\ast$}]{information\+Key }\end{DoxyParamCaption})}



This function returns the number of conflicts that is store in the key. 


\begin{DoxyParams}{Parameters}
{\em information\+Key} & contains the statistics in its meta information \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of conflicts stored in the key 
\end{DoxyReturn}
\mbox{\Hypertarget{kdbmerge_8h_ab17338c46c347a716ce354039310841b}\label{kdbmerge_8h_ab17338c46c347a716ce354039310841b}} 
\index{kdbmerge.h@{kdbmerge.h}!elektraMergeIsKeyConflicting@{elektraMergeIsKeyConflicting}}
\index{elektraMergeIsKeyConflicting@{elektraMergeIsKeyConflicting}!kdbmerge.h@{kdbmerge.h}}
\doxysubsubsection{\texorpdfstring{elektraMergeIsKeyConflicting()}{elektraMergeIsKeyConflicting()}}
{\footnotesize\ttfamily bool elektra\+Merge\+Is\+Key\+Conflicting (\begin{DoxyParamCaption}\item[{Key $\ast$}]{information\+Key,  }\item[{Key $\ast$}]{root,  }\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Check whether the given key was part of a conflict. 

NOTE\+: Even if the conflict was resolved via the provided conflict strategy, the key will still be marked as being part of a conflict.


\begin{DoxyParams}{Parameters}
{\em information\+Key} & stores errors as well as statistics \\
\hline
{\em root} & The root key (either for base, theirs, ours or result) that was used in the merge \\
\hline
{\em key} & That key that should be checked. Must be located under the specified root key \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if the key was part of a conflict \\
\hline
{\em 0} & if the key was not part of a conflict or the given root was not part of the merge \\
\hline
\end{DoxyRetVals}
